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:58:29 -0800
Even if there is a vtable, I suspect that this would technically work
because the vtable shows up at (Byte*)this - sizeof(void*).
I agree that it is skanky, though... unless his class implements an
operator uint16*, in which case it is fine. If the class doesn't
already include this operator, it should be added right away for safety.
On Dec 18, 2006, at 2:52 PM, David Duncan wrote:
On Dec 18, 2006, at 2:28 PM, Matt Fox-Wilson wrote:
gCString sResult = L"";
UniChar* sSource = (UniChar*)(uint16*)sRef;
This may not actually be a problem, but it is relying on the
internal layout of your class to function properly (I'm assuming
sRef is another instance of a gCString?). Unless the UniChar buffer
is inline at the start of this class and there are no virtual
functions, this shouldn't work. All of that may even be true, but I
wouldn't rely on it and it would probably be very useful to add a
UniCharPtr() accessor to your class that just returns a UniChar* to
your characters.
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;
--
David Duncan
Apple DTS Quartz and Printing
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