[vlc-commits] [Git][videolan/vlc][master] 4 commits: macosx: Remove faulty assumption on statistics update in information window

Felix Paul Kühne (@fkuehne) gitlab at videolan.org
Tue Mar 4 06:00:43 UTC 2025



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


Commits:
2f423e6a by Claudio Cambra at 2025-03-04T05:37:47+00:00
macosx: Remove faulty assumption on statistics update in information window

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
88a73aca by Claudio Cambra at 2025-03-04T05:37:47+00:00
macosx: simplify FILL_FIELD_FROM_INPUTITEM

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
86b92169 by Claudio Cambra at 2025-03-04T05:37:47+00:00
macosx: Ensure all XIB/UI related values set on main queue in information window controller

Fixes multiple bugs with view value changes not being reflected as
expected

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
aa15eaa7 by Claudio Cambra at 2025-03-04T05:37:47+00:00
macosx: When set as a main menu's instance, update the presented item on stat target change in info window

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -


1 changed file:

- modules/gui/macosx/panels/VLCInformationWindowController.m


Changes:

=====================================
modules/gui/macosx/panels/VLCInformationWindowController.m
=====================================
@@ -343,8 +343,10 @@ _##field##TextField.delegate = self
         dispatch_group_wait(group, DISPATCH_TIME_FOREVER);
 
         if (artworkImages.count == 0) {
-            _artwork = [NSImage imageNamed:@"noart.png"];
-            [self updateRepresentation];
+            dispatch_async(dispatch_get_main_queue(), ^{
+                _artwork = [NSImage imageNamed:@"noart.png"];
+                [self updateRepresentation];
+            });
             return;
         }
 
@@ -356,11 +358,14 @@ _##field##TextField.delegate = self
             [NSImage framesForCompositeImageSquareGridWithImages:artworkImages
                                                             size:artworkSize
                                                    gridItemCount:artworkImages.count];
-        _artwork = [NSImage compositeImageWithImages:artworkImages
-                                              frames:frames
-                                                size:artworkSize];
 
-        [self updateRepresentation];
+        dispatch_async(dispatch_get_main_queue(), ^{
+            _artwork = [NSImage compositeImageWithImages:artworkImages
+                                                frames:frames
+                                                    size:artworkSize];
+
+            [self updateRepresentation];
+        });
     });
 }
 
@@ -398,8 +403,10 @@ _##field##TextField.delegate = self
         dispatch_group_wait(group, DISPATCH_TIME_FOREVER);
 
         if (artworkImages.count == 0) {
-            _artwork = [NSImage imageNamed:@"noart.png"];
-            [self updateRepresentation];
+            dispatch_async(dispatch_get_main_queue(), ^{
+                _artwork = [NSImage imageNamed:@"noart.png"];
+                [self updateRepresentation];
+            });
             return;
         }
 
@@ -411,11 +418,13 @@ _##field##TextField.delegate = self
             [NSImage framesForCompositeImageSquareGridWithImages:artworkImages
                                                             size:artworkSize
                                                    gridItemCount:artworkImages.count];
-        _artwork = [NSImage compositeImageWithImages:artworkImages
-                                              frames:frames
-                                                size:artworkSize];
 
-        [self updateRepresentation];
+        dispatch_async(dispatch_get_main_queue(), ^{
+            _artwork = [NSImage compositeImageWithImages:artworkImages
+                                                frames:frames
+                                                    size:artworkSize];
+            [self updateRepresentation];
+        });
     });
 }
 
@@ -431,8 +440,11 @@ _##field##TextField.delegate = self
         VLCMain.sharedInstance.playQueueController.playerController;
     VLCInputItem * const currentPlayingItem = playerController.currentMedia;
     VLCInputItem * const firstItem = self.representedInputItems.firstObject;
-    NSAssert([currentPlayingItem.MRL isEqualToString:firstItem.MRL],
-             @"Should not update statistics when items are different!");
+    
+    if (self.mainMenuInstance && ![currentPlayingItem.MRL isEqualToString:firstItem.MRL]) {
+        self.representedInputItems = @[currentPlayingItem];
+    }
+
     NSAssert(_statisticsEnabled, @"Statistics should not be updated when they are disabled!");
     VLCInputStats * const inputStats = aNotification.userInfo[VLCPlayerInputStats];
     NSAssert(inputStats != nil, @"inputStats received for statistics update should not be nil!");
@@ -470,15 +482,8 @@ _##field##TextField.delegate = self
         [inputItem parseInputItem];
     }
 
-#define FILL_FIELD_FROM_INPUTITEM(field)                            \
-    {                                                               \
-    NSString * const inputItemString = inputItem.field;             \
-    if (inputItemString != nil) {                                   \
-        _##field##TextField.originalStateString = inputItemString;  \
-    } else {                                                        \
-        _##field##TextField.originalStateString = @"";              \
-    }                                                               \
-}
+#define FILL_FIELD_FROM_INPUTITEM(field)                                                    \
+_##field##TextField.originalStateString = inputItem.field == nil ? @"" : inputItem.field;
 
     PERFORM_ACTION_ALL_TEXTFIELDS(FILL_FIELD_FROM_INPUTITEM);
 
@@ -487,9 +492,7 @@ _##field##TextField.delegate = self
     _artworkImageButton.image = _artwork;
 
     if (!_mainMenuInstance) {
-        dispatch_async(dispatch_get_main_queue(), ^{
-            self.window.title = inputItem.title;
-        });
+        self.window.title = inputItem.title;
     }
 }
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/80ca615d96cddb7493ef1183a32c42efc23d0cfe...aa15eaa7d8051e1223d6eba226857d9dbcf7756f

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/80ca615d96cddb7493ef1183a32c42efc23d0cfe...aa15eaa7d8051e1223d6eba226857d9dbcf7756f
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