vlc | branch: master | Colin Delacroix <[email protected]> | Tue Mar 27 12:31:32 
2012 +0200| [f0cf9397cb828e55a50f17273e1c120f8b1396c7] | committer: Felix Paul 
Kühne

Fix a crash on Mac OS X when mounting volumes

Hi there

my VLC 2.0.1 has been crashing randomly on OS X 10.7 during Time Machine 
backups, and it was a thread-safety issue.

Signed-off-by: Felix Paul Kühne <[email protected]>

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

 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 0fc311f..0f00bea 100644
--- a/modules/gui/macosx/open.m
+++ b/modules/gui/macosx/open.m
@@ -844,8 +844,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) {

_______________________________________________
vlc-commits mailing list
[email protected]
http://mailman.videolan.org/listinfo/vlc-commits

Reply via email to