[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [30596] tags/blender-2.53-release/blender/ intern/ghost/intern/GHOST_WindowCocoa.mm: OSX/Cocoa : fix crash when opening/saving . blend with accented characters in their filename

Damien Plisson damien.plisson at yahoo.fr
Wed Jul 21 21:44:11 CEST 2010


Revision: 30596
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30596
Author:   damien78
Date:     2010-07-21 21:44:06 +0200 (Wed, 21 Jul 2010)

Log Message:
-----------
OSX/Cocoa : fix crash when opening/saving .blend with accented characters in their filename

Modified Paths:
--------------
    tags/blender-2.53-release/blender/intern/ghost/intern/GHOST_WindowCocoa.mm

Modified: tags/blender-2.53-release/blender/intern/ghost/intern/GHOST_WindowCocoa.mm
===================================================================
--- tags/blender-2.53-release/blender/intern/ghost/intern/GHOST_WindowCocoa.mm	2010-07-21 19:12:18 UTC (rev 30595)
+++ tags/blender-2.53-release/blender/intern/ghost/intern/GHOST_WindowCocoa.mm	2010-07-21 19:44:06 UTC (rev 30596)
@@ -481,8 +481,13 @@
     GHOST_ASSERT(getValid(), "GHOST_WindowCocoa::setTitle(): window invalid")
 	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
 
-	NSString *windowTitle = [[NSString alloc] initWithUTF8String:title];
+	NSString *windowTitle = [[NSString alloc] initWithCString:title encoding:NSASCIIStringEncoding];
 	
+	if (windowTitle == nil) {
+		[pool drain];
+		return;
+	}
+	
 	//Set associated file if applicable
 	if ([windowTitle hasPrefix:@"Blender"])
 	{
@@ -530,7 +535,7 @@
 	NSString *windowTitle = [m_window title];
 
 	if (windowTitle != nil) {
-		title = [windowTitle UTF8String];		
+		title = [windowTitle cStringUsingEncoding:NSASCIIStringEncoding];		
 	}
 	
 	[pool drain];





More information about the Bf-blender-cvs mailing list