[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [27619] trunk/blender/intern/ghost/intern/ GHOST_WindowCocoa.mm: Cocoa: fix some mem leaks appearing on 10.4 builds

Damien Plisson damien.plisson at yahoo.fr
Sat Mar 20 11:14:59 CET 2010


Revision: 27619
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=27619
Author:   damien78
Date:     2010-03-20 11:14:59 +0100 (Sat, 20 Mar 2010)

Log Message:
-----------
Cocoa: fix some mem leaks appearing on 10.4 builds

Modified Paths:
--------------
    trunk/blender/intern/ghost/intern/GHOST_WindowCocoa.mm

Modified: trunk/blender/intern/ghost/intern/GHOST_WindowCocoa.mm
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_WindowCocoa.mm	2010-03-20 05:14:22 UTC (rev 27618)
+++ trunk/blender/intern/ghost/intern/GHOST_WindowCocoa.mm	2010-03-20 10:14:59 UTC (rev 27619)
@@ -593,6 +593,7 @@
 GHOST_TSuccess GHOST_WindowCocoa::setClientWidth(GHOST_TUns32 width)
 {
 	GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::setClientWidth(): window invalid")
+	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
 	GHOST_Rect cBnds, wBnds;
 	getClientBounds(cBnds);
 	if (((GHOST_TUns32)cBnds.getWidth()) != width) {
@@ -601,6 +602,7 @@
 		size.height=cBnds.getHeight();
 		[m_window setContentSize:size];
 	}
+	[pool drain];
 	return GHOST_kSuccess;
 }
 
@@ -608,6 +610,7 @@
 GHOST_TSuccess GHOST_WindowCocoa::setClientHeight(GHOST_TUns32 height)
 {
 	GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::setClientHeight(): window invalid")
+	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
 	GHOST_Rect cBnds, wBnds;
 	getClientBounds(cBnds);
 	if (((GHOST_TUns32)cBnds.getHeight()) != height) {
@@ -616,6 +619,7 @@
 		size.height=height;
 		[m_window setContentSize:size];
 	}
+	[pool drain];
 	return GHOST_kSuccess;
 }
 
@@ -623,6 +627,7 @@
 GHOST_TSuccess GHOST_WindowCocoa::setClientSize(GHOST_TUns32 width, GHOST_TUns32 height)
 {
 	GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::setClientSize(): window invalid")
+	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
 	GHOST_Rect cBnds, wBnds;
 	getClientBounds(cBnds);
 	if ((((GHOST_TUns32)cBnds.getWidth()) != width) ||
@@ -632,6 +637,7 @@
 		size.height=height;
 		[m_window setContentSize:size];
 	}
+	[pool drain];
 	return GHOST_kSuccess;
 }
 
@@ -1020,8 +1026,6 @@
 {
 	static bool systemCursorVisible = true;
 	
-	NSAutoreleasePool *pool =[[NSAutoreleasePool alloc] init];
-
 	NSCursor *tmpCursor =nil;
 	
 	if (visible != systemCursorVisible) {
@@ -1085,17 +1089,19 @@
 		};
 	}
 	[tmpCursor set];
-	[pool drain];
 }
 
 
 
 GHOST_TSuccess GHOST_WindowCocoa::setWindowCursorVisibility(bool visible)
 {
+	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init];
+	
 	if ([m_window isVisible]) {
 		loadCursor(visible, getCursorShape());
 	}
 	
+	[pool drain];
 	return GHOST_kSuccess;
 }
 
@@ -1146,6 +1152,8 @@
 	
 GHOST_TSuccess GHOST_WindowCocoa::setWindowCursorShape(GHOST_TStandardCursor shape)
 {
+	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+
 	if (m_customCursor) {
 		[m_customCursor release];
 		m_customCursor = nil;
@@ -1155,6 +1163,7 @@
 		loadCursor(getCursorVisibility(), shape);
 	}
 	
+	[pool drain];
 	return GHOST_kSuccess;
 }
 





More information about the Bf-blender-cvs mailing list