[vlc-devel] [PATCH] Fix a crash on Mac OS X when mounting volumes
Colin Delacroix
colin at zoy.org
Tue Mar 27 12:31:32 CEST 2012
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.
---
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) {
--
1.7.4.4
More information about the vlc-devel
mailing list