[vlc-commits] [Git][videolan/vlc][master] 2 commits: macosx: VLCLibraryDataTypes: fix memory leak on medialibrary items
Felix Paul Kühne (@fkuehne)
gitlab at videolan.org
Sun Sep 8 04:58:32 UTC 2024
Felix Paul Kühne pushed to branch master at VideoLAN / VLC
Commits:
484f1497 by Alexandre Janniaux at 2024-09-08T04:43:55+00:00
macosx: VLCLibraryDataTypes: fix memory leak on medialibrary items
Stacktrace from the memory graph:
_malloc_zone_calloc_instrumented_or_legacy
vlc_ml_media_t* CreateAndConvert<vlc_ml_media_t, medialibrary::IMedia>(medialibrary::IMedia const*)
MediaLibrary::Get(int, char*)
vlc_ml_get
lc_ml_get_media_by_mrl
+[VLCMediaLibraryMediaItem mediaItemForURL:]
-[VLCControlsBarCommon updateCurrentItemDisplayControls:]
-[VLCMainVideoViewControlsBar update]
-[VLCMainVideoViewController viewDidLoad]
-[NSViewController _sendViewDidLoad]
-[NSViewController _loadViewIfRequired]
__24-[NSViewController view]_block_invoke
NSPerformVisuallyAtomicChange
-[NSViewController view]
-[VLCLibraryWindow awakeFromNib]
...
- - - - -
da23e939 by Alexandre Janniaux at 2024-09-08T04:43:55+00:00
macosx: VLCExtensionsManager: unload extensions on dealloc
Fixes a memory leak with extension manager not being unloaded when the
application exits. Created from the following stacktrace:
generic_start
vlc_module_load
module_need
-[VLCExtensionsManager loadExtensions]
-[VLCExtensionsManager buildMenu:]
-[VLCMainMenu awakeFromNib]
- - - - -
2 changed files:
- modules/gui/macosx/library/VLCLibraryDataTypes.m
- modules/gui/macosx/windows/extensions/VLCExtensionsManager.m
Changes:
=====================================
modules/gui/macosx/library/VLCLibraryDataTypes.m
=====================================
@@ -989,11 +989,11 @@ static NSString *genreArrayDisplayString(NSArray<VLCMediaLibraryGenre *> * const
return nil;
}
vlc_ml_media_t *p_mediaItem = vlc_ml_get_media(p_mediaLibrary, libraryID);
- VLCMediaLibraryMediaItem *returnValue = nil;
- if (p_mediaItem) {
- returnValue = [[VLCMediaLibraryMediaItem alloc] initWithMediaItem:p_mediaItem library:p_mediaLibrary];
- }
- return returnValue;
+ if (p_mediaItem == NULL)
+ return nil;
+ VLCMediaLibraryMediaItem *media = [[VLCMediaLibraryMediaItem alloc] initWithMediaItem:p_mediaItem library:p_mediaLibrary];
+ vlc_ml_media_release(p_mediaItem);
+ return media;
}
+ (nullable instancetype)mediaItemForURL:(NSURL *)url
@@ -1008,11 +1008,12 @@ static NSString *genreArrayDisplayString(NSArray<VLCMediaLibraryGenre *> * const
}
vlc_ml_media_t *p_mediaItem = vlc_ml_get_media_by_mrl(p_mediaLibrary,
[[url absoluteString] UTF8String]);
- VLCMediaLibraryMediaItem *returnValue = nil;
- if (p_mediaItem) {
- returnValue = [[VLCMediaLibraryMediaItem alloc] initWithMediaItem:p_mediaItem library:p_mediaLibrary];
- }
- return returnValue;
+ if (p_mediaItem == NULL)
+ return nil;
+
+ VLCMediaLibraryMediaItem *media = [[VLCMediaLibraryMediaItem alloc] initWithMediaItem:p_mediaItem library:p_mediaLibrary];
+ vlc_ml_media_release(p_mediaItem);
+ return media;
}
- (nullable instancetype)initWithMediaItem:(struct vlc_ml_media_t *)p_mediaItem
=====================================
modules/gui/macosx/windows/extensions/VLCExtensionsManager.m
=====================================
@@ -277,6 +277,7 @@
intf_thread_t *p_intf = getIntf();
msg_Dbg(p_intf, "Deinitializing extensions manager");
+ [self unloadExtensions];
_extensionDialogProvider = nil;
if (p_extensions_manager)
vlc_object_delete(p_extensions_manager);
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/581b4e8464cd9cc56e047ebbf6ac149da2d2a028...da23e939a5595de6fe123fb54a7d41a9833e0b3f
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/581b4e8464cd9cc56e047ebbf6ac149da2d2a028...da23e939a5595de6fe123fb54a7d41a9833e0b3f
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