[vlc-commits] Fix a crash on Mac OS X when mounting volumes

Colin Delacroix git at videolan.org
Tue Mar 27 16:27:57 CEST 2012


vlc/vlc-2.0 | branch: master | Colin Delacroix <colin at zoy.org> | Tue Mar 27 12:31:32 2012 +0200| [a0ec0a367cebf5569ca70dad322ead58c4c7ed9d] | committer: Felix Paul Kühne

Fix a crash on Mac OS X when mounting volumes

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=a0ec0a367cebf5569ca70dad322ead58c4c7ed9d
---

 modules/gui/macosx/open.m |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/modules/gui/macosx/open.m b/modules/gui/macosx/open.m
index 2381a2d..5bb14d5 100644
--- a/modules/gui/macosx/open.m
+++ b/modules/gui/macosx/open.m
@@ -775,8 +775,12 @@ static VLCOpen *_o_sharedMainInstance = nil;
                 returnValue = kVLCMediaBDMVFolder;
             else
             {
+                // NSFileManager is not thread-safe, don't use defaultManager outside of the main thread
+                NSFileManager * fm = [[NSFileManager alloc] init];
                 NSArray * topLevelItems;
-                topLevelItems = [[NSFileManager defaultManager] subpathsOfDirectoryAtPath: mountPath error: NULL];
+                topLevelItems = [fm subpathsOfDirectoryAtPath: mountPath error: NULL];
+                [fm release];
+
                 NSUInteger itemCount = [topLevelItems count];
                 for (int i = 0; i < itemCount; i++) {
                     if([[topLevelItems objectAtIndex:i] rangeOfString:@"SVCD"].location != NSNotFound) {



More information about the vlc-commits mailing list