[vlc-commits] macosx: fix assert on quit

Felix Paul Kühne git at videolan.org
Mon Feb 11 14:30:53 CET 2019


vlc | branch: master | Felix Paul Kühne <felix at feepk.net> | Mon Feb 11 12:55:30 2019 +0100| [75360ce4f2d9060a15ab471dfa59cea30290f41f] | committer: Felix Paul Kühne

macosx: fix assert on quit

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=75360ce4f2d9060a15ab471dfa59cea30290f41f
---

 modules/gui/macosx/main/VLCMain.m                   | 3 +++
 modules/gui/macosx/playlist/VLCPlayerController.h   | 1 +
 modules/gui/macosx/playlist/VLCPlayerController.m   | 2 +-
 modules/gui/macosx/playlist/VLCPlaylistController.h | 1 +
 modules/gui/macosx/playlist/VLCPlaylistController.m | 6 +++++-
 5 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/modules/gui/macosx/main/VLCMain.m b/modules/gui/macosx/main/VLCMain.m
index de10389fd0..c5447681a5 100644
--- a/modules/gui/macosx/main/VLCMain.m
+++ b/modules/gui/macosx/main/VLCMain.m
@@ -278,6 +278,9 @@ static VLCMain *sharedInstance = nil;
 - (void)dealloc
 {
     msg_Dbg(getIntf(), "Deinitializing VLCMain object");
+
+    /* have the playlist controller explicitly unsubscribe from events prior to its deallocation */
+    [_playlistController deinitialize];
 }
 
 - (void)applicationWillFinishLaunching:(NSNotification *)aNotification
diff --git a/modules/gui/macosx/playlist/VLCPlayerController.h b/modules/gui/macosx/playlist/VLCPlayerController.h
index 3406f236c9..89d22e8e30 100644
--- a/modules/gui/macosx/playlist/VLCPlayerController.h
+++ b/modules/gui/macosx/playlist/VLCPlayerController.h
@@ -147,6 +147,7 @@ extern NSString *VLCPlayerMuteChanged;
 @interface VLCPlayerController : NSObject
 
 - (instancetype)initWithPlayer:(vlc_player_t *)player;
+- (void)deinitialize;
 
 /**
  * Start playback of the current media
diff --git a/modules/gui/macosx/playlist/VLCPlayerController.m b/modules/gui/macosx/playlist/VLCPlayerController.m
index e3666f9771..9f25e39b36 100644
--- a/modules/gui/macosx/playlist/VLCPlayerController.m
+++ b/modules/gui/macosx/playlist/VLCPlayerController.m
@@ -339,7 +339,7 @@ static const struct vlc_player_aout_cbs player_aout_callbacks = {
     return self;
 }
 
-- (void)dealloc
+- (void)deinitialize
 {
     if (_p_player) {
         if (_playerListenerID) {
diff --git a/modules/gui/macosx/playlist/VLCPlaylistController.h b/modules/gui/macosx/playlist/VLCPlaylistController.h
index b7ae845816..37ccfcb541 100644
--- a/modules/gui/macosx/playlist/VLCPlaylistController.h
+++ b/modules/gui/macosx/playlist/VLCPlaylistController.h
@@ -37,6 +37,7 @@ extern NSString *VLCPlaybackHasNextChanged;
 @interface VLCPlaylistController : NSObject
 
 - (instancetype)initWithPlaylist:(vlc_playlist_t *)playlist;
+- (void)deinitialize;
 
 /**
  * The vlc core playlist controlled by the instance of this class
diff --git a/modules/gui/macosx/playlist/VLCPlaylistController.m b/modules/gui/macosx/playlist/VLCPlaylistController.m
index 0164895c6d..503a93c369 100644
--- a/modules/gui/macosx/playlist/VLCPlaylistController.m
+++ b/modules/gui/macosx/playlist/VLCPlaylistController.m
@@ -213,8 +213,12 @@ static const struct vlc_playlist_callbacks playlist_callbacks = {
     return self;
 }
 
-- (void)dealloc
+- (void)deinitialize
 {
+    if (_playerController) {
+        [_playerController deinitialize];
+    }
+
     if (_p_playlist) {
         if (_playlistListenerID) {
             vlc_playlist_Lock(_p_playlist);



More information about the vlc-commits mailing list