Commit f0cf9397 authored by Colin Delacroix's avatar Colin Delacroix Committed by 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: default avatarFelix Paul Kühne <fkuehne@videolan.org>
parent 75e2c929
...@@ -844,8 +844,12 @@ static VLCOpen *_o_sharedMainInstance = nil; ...@@ -844,8 +844,12 @@ static VLCOpen *_o_sharedMainInstance = nil;
returnValue = kVLCMediaBDMVFolder; returnValue = kVLCMediaBDMVFolder;
else else
{ {
// NSFileManager is not thread-safe, don't use defaultManager outside of the main thread
NSFileManager * fm = [[NSFileManager alloc] init];
NSArray * topLevelItems; NSArray * topLevelItems;
topLevelItems = [[NSFileManager defaultManager] subpathsOfDirectoryAtPath: mountPath error: NULL]; topLevelItems = [fm subpathsOfDirectoryAtPath: mountPath error: NULL];
[fm release];
NSUInteger itemCount = [topLevelItems count]; NSUInteger itemCount = [topLevelItems count];
for (int i = 0; i < itemCount; i++) { for (int i = 0; i < itemCount; i++) {
if([[topLevelItems objectAtIndex:i] rangeOfString:@"SVCD"].location != NSNotFound) { if([[topLevelItems objectAtIndex:i] rangeOfString:@"SVCD"].location != NSNotFound) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment