Re: NSGraphicsContext restore crashes my xtension
Re: NSGraphicsContext restore crashes my xtension
- Subject: Re: NSGraphicsContext restore crashes my xtension
- From: glenn andreas <email@hidden>
- Date: Sun, 27 Jul 2008 12:50:38 -0500
On Jul 27, 2008, at 12:35 PM, email@hidden wrote:
Hi
I wrote a Quark XTension that dynamically generates ad placeholder
images on a page and am having a problem where doing a restore on a
saved NSGraphicsContext crashes after the last ad is placed. If I
comment out the save/restore context, the app doesn't crash but it
also doesn't render the text parts of the placeholder image. The
exact code worked fine for months but It appears that something I
did outside of these functions had a ripple effect that causes save/
restore to fail. I've been futzing with this for two days and don't
seem to be any closer to solving it. Here's the gdb trace of the
crash. Anyone shed any light on why this might be happening?
You're setting a graphics context:
// uncommenting the next line works fine for all ads except the
last which
// causes a crash after the last ad image is placed.
//[NSGraphicsContext setCurrentContext: nsContext];
But you're never restoring the original context, and as a result, the
context is autoreleased later (and is still the current context).
saveGraphicsState and restoreGraphicsState only saves and restores the
state of the current context - it doesn't save/restore the current
context...
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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