MacOSX/Framework: Don't attempt to set a value of a dictionary that is being monitore...
authorPierre d'Herbemont <pdherbemont@videolan.org>
Tue, 15 Jan 2008 19:14:43 +0000 (19:14 +0000)
committerPierre d'Herbemont <pdherbemont@videolan.org>
Tue, 15 Jan 2008 19:14:43 +0000 (19:14 +0000)
extras/MacOSX/Framework/Sources/VLCMedia.m

index 792109d..865fbbe 100644 (file)
@@ -74,6 +74,7 @@ NSString * VLCMediaMetaChanged              = @"VLCMediaMetaChanged";
 /* Operations */
 - (void)fetchMetaInformationFromLibVLCWithType:(NSString*)metaType;
 - (void)fetchMetaInformationForArtWorkWithURL:(NSString *)anURL;
+- (void)setArtwork:(NSImage *)art;
 
 /* Callback Methods */
 - (void)metaChanged:(NSString *)metaType;
@@ -496,15 +497,17 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
     // If anything was found, lets save it to the meta data dictionary
     if (art)
     {
-        @synchronized(metaDictionary) 
-        {
-            [metaDictionary setObject:art forKey:VLCMetaInformationArtwork];
-        }
+        [self performSelectorOnMainThread:@selector(setArtwork:) withObject:art waitUntilDone:NO];
     }
 
     [pool release];
 }
 
+- (void)setArtwork:(NSImage *)art
+{
+    [metaDictionary setObject:art forKey:@"artwork"];
+}
+
 - (void)metaChanged:(NSString *)metaType
 {
     [self fetchMetaInformationFromLibVLCWithType:metaType];