Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualCordan

Posted 28 September 2012 - 02:07 PM

I getting EXC_BAD_ACCESS in virtual methods when i run program on iPad.
It happens only if method returns registered data type and if method have virtual definition in base class.

My code:

[source lang="cpp"]virtual my_type Base::method() = 0;...my_type Derived::method(){ ... this->field = 10; // EXC_BAD_ACCESS ...}[/source]

If i replace code above with:
[source lang="cpp"]virtual void Base::method(my_type &res) = 0;...void Derived::method(my_type &res){ ... this->field = 10; // OK ...}[/source]
problem will disappear.

I have this problem only on ios device. i've tested my code on windows, osx and iphone simulator - all is ok. If i replace 'my_type' to 'int' all is ok as well.

It looks like calling of virtual methods with wrong object.

So, what it can be?

ps: as version - 2.25.0

#1Cordan

Posted 28 September 2012 - 02:01 PM

I getting EXC_BAD_ACCESS in virtual methods when i run program on iPad.
It happens only if method returns registered data type and if method have virtual definition in base class.

My code:

[source lang="cpp"]virtual my_type Base::method() = 0;...my_type Derived::method(){ ... this->field = 10; // EXC_BAD_ACCESS ...}[/source]

If i replace code above with:
[source lang="cpp"]virtual void Base::method(my_type &res) = 0;...void Derived::method(my_type &res){ ... this->field = 10; // OK ...}[/source]
problem will disappear.

I have this problem only on ios device. i've tested my code on windows, osx and iphone simulator - all is ok. If i replace 'my_type' to 'int' all is ok as well.

It looks like calling of virtual methods with wrong object.

So, what it can be?

PARTNERS