]> git.saurik.com Git - wxWidgets.git/commitdiff
wxIcon::CopyFromBitmap:
authorDavid Elliott <dfe@tgwbd.org>
Sun, 11 Apr 2004 03:25:14 +0000 (03:25 +0000)
committerDavid Elliott <dfe@tgwbd.org>
Sun, 11 Apr 2004 03:25:14 +0000 (03:25 +0000)
1. retain NSImage from bitmap.GetNSImage (since it is alloc/autoreleased)
2. Use a wxAutoNSAutoreleasePool

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26697 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/cocoa/icon.mm

index 5299b5a6453b4c6ef5f7a118eeff8c44d57d2a4c..f3cb56d6d7d271fb57e2184d4b5056f426912eef 100644 (file)
@@ -15,6 +15,8 @@
 #endif //WX_PRECOMP
 #include "wx/bitmap.h"
 
+#include "wx/cocoa/autorelease.h"
+
 #import <AppKit/NSImage.h>
 
 // ========================================================================
@@ -122,7 +124,8 @@ void wxIcon::CopyFromBitmap(const wxBitmap& bitmap)
     m_refData = new wxIconRefData;
     M_ICONDATA->m_width = bitmap.GetWidth();
     M_ICONDATA->m_height = bitmap.GetHeight();
-    M_ICONDATA->m_cocoaNSImage = bitmap.GetNSImage(true);
+    wxAutoNSAutoreleasePool pool;
+    M_ICONDATA->m_cocoaNSImage = [bitmap.GetNSImage(true) retain];
     M_ICONDATA->m_ok = bitmap.Ok();
     M_ICONDATA->m_numColors = 0;
     M_ICONDATA->m_quality = 0;