From b6b5c9ae72b45b6708b375d34ee35217732010cc Mon Sep 17 00:00:00 2001
From: Claudio Cambra <developer@claudiocambra.com>
Date: Sun, 8 Sep 2024 19:43:42 +0800
Subject: [PATCH] macosx: Use retained media source library view controller on
 segment property in library window

Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
---
 modules/gui/macosx/library/VLCLibraryWindow.m | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/modules/gui/macosx/library/VLCLibraryWindow.m b/modules/gui/macosx/library/VLCLibraryWindow.m
index 23c5ad1a3590..bce525998a1e 100644
--- a/modules/gui/macosx/library/VLCLibraryWindow.m
+++ b/modules/gui/macosx/library/VLCLibraryWindow.m
@@ -431,15 +431,13 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
 
     const VLCLibrarySegmentType segmentType = self.librarySegmentType;
     [self.toolbarDelegate layoutForSegment:segmentType];
-    VLCLibraryMediaSourceViewController * const lvc =
-        [[VLCLibraryMediaSourceViewController alloc] initWithLibraryWindow:self];
 
     if (segmentType == VLCLibraryBrowseSegment) {
-        [lvc presentBrowseView];
+        [self.libraryMediaSourceViewController presentBrowseView];
     } else if (segmentType == VLCLibraryStreamsSegment) {
-        [lvc presentStreamsView];
+        [self.libraryMediaSourceViewController presentStreamsView];
     }
-    _librarySegmentViewController = lvc;
+    _librarySegmentViewController = self.libraryMediaSourceViewController;
 }
 
 - (void)showGroupsLibrary
-- 
GitLab