[vlc-commits] [Git][videolan/vlc][master] macosx: Fix UI hanging when scrolling in streams section

Felix Paul Kühne (@fkuehne) gitlab at videolan.org
Sun Aug 31 04:52:24 UTC 2025



Felix Paul Kühne pushed to branch master at VideoLAN / VLC


Commits:
ed4469ed by Bob Moriasi at 2025-08-31T04:11:07+00:00
macosx:  Fix UI hanging when scrolling in streams section

- - - - -


1 changed file:

- modules/gui/macosx/library/VLCLibraryImageCache.m


Changes:

=====================================
modules/gui/macosx/library/VLCLibraryImageCache.m
=====================================
@@ -140,26 +140,31 @@ const NSUInteger kVLCCompositeImageDefaultCompositedGridItemCount = 4;
                    withCompletion:(void(^)(const NSImage *))completionHandler
 {
     NSURL * const artworkURL = inputItem.artworkURL;
-    NSImage * const image = [[NSImage alloc] initWithContentsOfURL:artworkURL];
     const NSSize imageSize = NSMakeSize(kVLCDesiredThumbnailWidth, kVLCDesiredThumbnailHeight);
-
-    if (image) {
-        image.size = imageSize;
-        [_imageCache setObject:image forKey:inputItem.MRL];
-        completionHandler(image);
-    } else {
-        [inputItem thumbnailWithSize:imageSize completionHandler:^(NSImage * const image) {
-            dispatch_async(dispatch_get_main_queue(), ^{
-                if (image) {
-                    [_imageCache setObject:image forKey:inputItem.MRL];
-                    completionHandler(image);
-                } else {
-                    NSLog(@"Failed to generate thumbnail for input item %@", inputItem.MRL);
-                    completionHandler([NSImage imageNamed:@"noart.png"]);
-                }
-            });
-        }];
-    }
+    
+    dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INITIATED, 0), ^{
+        NSImage * image = [[NSImage alloc] initWithContentsOfURL:artworkURL];
+        
+        dispatch_async(dispatch_get_main_queue(), ^{
+            if (image) {
+                image.size = imageSize;
+                [self->_imageCache setObject:image forKey:inputItem.MRL];
+                completionHandler(image);
+            } else {
+                [inputItem thumbnailWithSize:imageSize completionHandler:^(NSImage * const image) {
+                    dispatch_async(dispatch_get_main_queue(), ^{
+                        if (image) {
+                            [self->_imageCache setObject:image forKey:inputItem.MRL];
+                            completionHandler(image);
+                        } else {
+                            NSLog(@"Failed to generate thumbnail for input item %@", inputItem.MRL);
+                            completionHandler([NSImage imageNamed:@"noart.png"]);
+                        }
+                    });
+                }];
+            }
+        });
+    });
 }
 
 + (void)thumbnailForPlayQueueItem:(VLCPlayQueueItem *)playQueueItem



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/ed4469edc59447d39d232e5ae50f154e9696b606

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/ed4469edc59447d39d232e5ae50f154e9696b606
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list