objective c - EXC_BAD_ACCESS on alloc -
if issue has been posted before, can't find it.
i'm attempting allocate , initialize instance of nsstring in initialization method of subclass of nsoperation (for use nsoperationqueue). nsstring pointer ivar (not property).
the program crashes "exc_bad_access (code=exc_i386_gpflt)".
to isolate problem, i've separated alloc , init functions. main thread crashing on:
m_mystring = [nsstring alloc];
the code in "if" block:
if (somecondition) { m_mystring = [nsstring alloc]; m_mystring = [m_mystring initwithcstring:acharpointer encoding:nsasciistringencoding]; } else { m_mystring = [nsstring alloc]; m_mystring = [m_mystring initwitcstring:adifferentcharpointer encoding:nsasciistringencoding]; }
examining thread shows it's crashing on objc_release. don't understand why release called on object in allocation method, seems case...
it's worth mentioning alloc , init instance variable nsstring in same method before if block.
has else run before, , if so, how'd solve it?
i'd glad give more info upon request.
Comments
Post a Comment