diff options
author | Kevin Walzer <kw@codebykevin.com> | 2015-03-10 14:47:46 (GMT) |
---|---|---|
committer | Kevin Walzer <kw@codebykevin.com> | 2015-03-10 14:47:46 (GMT) |
commit | 67ea4cdad9c315a20891a4f7c24006324fb73fc5 (patch) | |
tree | 2cd6273761d6289fbfdd5b189e9abb13d22fc0dc /macosx | |
parent | 2f79017b3381d1614b5384147ca2a3d144c5f334 (diff) | |
download | tk-67ea4cdad9c315a20891a4f7c24006324fb73fc5.zip tk-67ea4cdad9c315a20891a4f7c24006324fb73fc5.tar.gz tk-67ea4cdad9c315a20891a4f7c24006324fb73fc5.tar.bz2 |
Fix for crash when image is dealloc'ed prematurely in Cocoa
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/tkMacOSXDraw.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c index f94c8af..c1ffdf8 100644 --- a/macosx/tkMacOSXDraw.c +++ b/macosx/tkMacOSXDraw.c @@ -148,7 +148,8 @@ BitmapRepFromDrawableRect( cg_image = CGBitmapContextCreateImage( (CGContextRef) cg_context); sub_cg_image = CGImageCreateWithImageInRect(cg_image, image_rect); if ( sub_cg_image ) { - bitmap_rep = [[NSBitmapImageRep alloc] autorelease]; + /*This can be dealloc'ed prematurely if set for autorelease, causing crashes.*/ + bitmap_rep = [NSBitmapImageRep alloc]; [bitmap_rep initWithCGImage:sub_cg_image]; } if ( cg_image ) { @@ -162,7 +163,8 @@ BitmapRepFromDrawableRect( width,height); if ( [view lockFocusIfCanDraw] ) { - bitmap_rep = [[NSBitmapImageRep alloc] autorelease]; + /*This can be dealloc'ed prematurely if set for autorelease, causing crashes.*/ + bitmap_rep = [NSBitmapImageRep alloc]; bitmap_rep = [bitmap_rep initWithFocusedViewRect:view_rect]; [view unlockFocus]; } else { |