[Bf-blender-cvs] [3f948369223] master: Fix T50788: blender startup crash on macOS with some types of volumes available.

Brecht Van Lommel noreply at git.blender.org
Sun Mar 12 18:03:40 CET 2017


Commit: 3f948369223e30f86d3abacf8f89f2c5aeb61214
Author: Brecht Van Lommel
Date:   Sun Mar 12 15:48:44 2017 +0100
Branches: master
https://developer.blender.org/rB3f948369223e30f86d3abacf8f89f2c5aeb61214

Fix T50788: blender startup crash on macOS with some types of volumes available.

===================================================================

M	source/blender/editors/space_file/fsmenu.c

===================================================================

diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c
index 631ff06a77a..d7aa1040e0f 100644
--- a/source/blender/editors/space_file/fsmenu.c
+++ b/source/blender/editors/space_file/fsmenu.c
@@ -537,28 +537,22 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks)
 		/* Finally get user favorite places */
 		if (read_bookmarks) {
 			UInt32 seed;
-			OSErr err = noErr;
-			CFArrayRef pathesArray;
-			LSSharedFileListRef list;
-			LSSharedFileListItemRef itemRef;
-			CFIndex i, pathesCount;
-			CFURLRef cfURL = NULL;
-			CFStringRef pathString = NULL;
-			list = LSSharedFileListCreate(NULL, kLSSharedFileListFavoriteItems, NULL);
-			pathesArray = LSSharedFileListCopySnapshot(list, &seed);
-			pathesCount = CFArrayGetCount(pathesArray);
+			LSSharedFileListRef list = LSSharedFileListCreate(NULL, kLSSharedFileListFavoriteItems, NULL);
+			CFArrayRef pathesArray = LSSharedFileListCopySnapshot(list, &seed);
+			CFIndex pathesCount = CFArrayGetCount(pathesArray);
 			
-			for (i = 0; i < pathesCount; i++) {
-				itemRef = (LSSharedFileListItemRef)CFArrayGetValueAtIndex(pathesArray, i);
+			for (CFIndex i = 0; i < pathesCount; i++) {
+				LSSharedFileListItemRef itemRef = (LSSharedFileListItemRef)CFArrayGetValueAtIndex(pathesArray, i);
 				
-				err = LSSharedFileListItemResolve(itemRef, 
-				                                  kLSSharedFileListNoUserInteraction |
-				                                  kLSSharedFileListDoNotMountVolumes,
-				                                  &cfURL, NULL);
-				if (err != noErr)
+				CFURLRef cfURL = NULL;
+				OSErr err = LSSharedFileListItemResolve(itemRef, 
+				                                        kLSSharedFileListNoUserInteraction |
+				                                        kLSSharedFileListDoNotMountVolumes,
+				                                        &cfURL, NULL);
+				if (err != noErr || !cfURL)
 					continue;
 				
-				pathString = CFURLCopyFileSystemPath(cfURL, kCFURLPOSIXPathStyle);
+				CFStringRef pathString = CFURLCopyFileSystemPath(cfURL, kCFURLPOSIXPathStyle);
 				
 				if (pathString == NULL || !CFStringGetCString(pathString, line, sizeof(line), kCFStringEncodingUTF8))
 					continue;




More information about the Bf-blender-cvs mailing list