Fix OS X memory leak prints when starting blender:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Thu, 16 Sep 2010 19:42:51 +0000 (19:42 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Thu, 16 Sep 2010 19:42:51 +0000 (19:42 +0000)
"__NSAutoreleaseNoPool() ... autoreleased with no pool in place - just leaking"

intern/ghost/intern/GHOST_WindowCocoa.mm

index a97f7621bb093a0120cd69ddc5dd50832979491e..83f86840eb4b0b61f978ef69ac4e95478a9bc707 100644 (file)
@@ -783,9 +783,9 @@ GHOST_TSuccess GHOST_WindowCocoa::setState(GHOST_TWindowState state)
                        break;
                case GHOST_kWindowStateNormal:
         default:
+                       NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
                        if (m_fullScreen)
                        {
-                               NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
                                m_fullScreen = false;
 
                                //Exit fullscreen
@@ -835,15 +835,15 @@ GHOST_TSuccess GHOST_WindowCocoa::setState(GHOST_TWindowState state)
                        
                                //Tell WM of view new size
                                m_systemCocoa->handleWindowEvent(GHOST_kEventWindowSize, this);
-                               
-                               [pool drain];
                        }
             else if ([m_window isMiniaturized])
                                [m_window deminiaturize:nil];
                        else if ([m_window isZoomed])
                                [m_window zoom:nil];
+                       [pool drain];
             break;
     }
+
     return GHOST_kSuccess;
 }