Re: Cocoa called from Carbon, objc_msgSend crash in 10.3.9.
Re: Cocoa called from Carbon, objc_msgSend crash in 10.3.9.
- Subject: Re: Cocoa called from Carbon, objc_msgSend crash in 10.3.9.
- From: John Stiles <email@hidden>
- Date: Mon, 18 Dec 2006 14:33:48 -0800
You aren't freeing your autorelease pool; that could have adverse
effects. I'm not sure that this is the problem, but it might be
related, and is definitely worth fixing.
Before the end of the function, just add
[pool release];
On Dec 18, 2006, at 2:28 PM, Matt Fox-Wilson wrote:
Hi all,
I've got a user reporting a crash in my product (Carbon product,
making
Cocoa calls hence my post to this list) since installing the latest
security
patch for 10.3.9. The product is built with the 10.4u SDK for
Intel, 10.3.9
SDK for PPC, and is set to a 10.3 Development Target and G3 model
tuning and
CPU for PPC (we still have a fair few users on G3 machines).
Sending him a deployment build without the deployment post-
processing in
order to examine the process, we can see that he's getting an access
violation in objc_msgSend somewhere in the following code:
---------------
gCString sResult = L"";
UniChar* sSource = (UniChar*)(uint16*)sRef;
if (sRef.Length() < 1) return sResult;
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSString *
nsSrc = [NSString stringWithCharacters:sSource length:sRef.Length()];
NSString* nsExt = [nsSrc lastPathComponent];
sResult.CopyString((CFStringRef)nsExt);
return sResult;
---------------
The gCString is an internal C++ string handling class we have that
does a
bunch of memory checking so I suspect it's not in there (it also
doesn't
call any Cocoa functions). Given that the crash is in objc_msgSend,
I'm
assuming it's somewhere either in the NSAutoReleasePool code or
stringWithCharacters.
The code is working fine for some 10.3.9 users (I got my old G4
Cube up and
running 10.3.9 again with all the updates and it runs fine), and
fine for
10.4 PPC and Intel users.
We've done some research to try and see if anyone else had similar
problems
and found some notes that looked very familiar
(http://lists.apple.com/archives/carbon-dev/2006/Aug/msg00659.html).
However, the conclusion in that thread seemed to indicate that
turning off
'Accelerated Objective-C Dispatch' in Xcode solved their problem.
This was
already turned off in our projects so it looks like we have a
different
issue, or at least require a different solution.
Does anyone have any idea what could be happening here? While it's
only one
user, I'm concerned that we're doing something that might cause
this to
happen for more over time and I want to make sure I understand the
problem.
Any ideas would be much appreciated.
- Matt Fox-Wilson
- email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
40blizzard.com
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden