[vlc-commits] macosx: Implement different way to always store playback position

David Fuhrmann git at videolan.org
Sun Mar 18 19:02:18 CET 2018


vlc | branch: master | David Fuhrmann <dfuhrmann at videolan.org> | Sun Mar 18 18:55:19 2018 +0100| [2c0ea2ff607aa19defdb14ade9caa074cc115c9e] | committer: David Fuhrmann

macosx: Implement different way to always store playback position

The previous solution caused different problems. Therefore,
add this as a workaround to deinitialize InputManager, even if
the object still has strong references and therefore cannot be
destroyed yet.

The comment explains some problems, which look like not easily
fixable for the 3.0 branch.

close #19704

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

 modules/gui/macosx/VLCInputManager.h | 1 +
 modules/gui/macosx/VLCInputManager.m | 9 ++++++++-
 modules/gui/macosx/VLCMain.m         | 1 +
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/modules/gui/macosx/VLCInputManager.h b/modules/gui/macosx/VLCInputManager.h
index c76a8a1152..3a21e6184f 100644
--- a/modules/gui/macosx/VLCInputManager.h
+++ b/modules/gui/macosx/VLCInputManager.h
@@ -32,6 +32,7 @@
 @interface VLCInputManager : NSObject
 
 - (id)initWithMain:(VLCMain *)o_mainObj;
+- (void)deinit;
 
 - (void)inputThreadChanged;
 
diff --git a/modules/gui/macosx/VLCInputManager.m b/modules/gui/macosx/VLCInputManager.m
index 66a01c0aff..4ba1011c65 100644
--- a/modules/gui/macosx/VLCInputManager.m
+++ b/modules/gui/macosx/VLCInputManager.m
@@ -186,7 +186,14 @@ static int InputEvent(vlc_object_t *p_this, const char *psz_var,
     return self;
 }
 
-- (void)dealloc
+/*
+ * TODO: Investigate if this can be moved to dealloc again. Current problems:
+ * - dealloc might be never called of this object, as strong references could be in the
+ *   (already stopped) main loop, preventing the refcount to go 0.
+ * - Calling var_DelCallback waits for all callbacks to finish. Thus, while dealloc is already
+ *   called, callback might grab a reference to this object again, which could cause trouble.
+ */
+- (void)deinit
 {
     msg_Dbg(getIntf(), "Deinitializing input manager");
     if (p_current_input) {
diff --git a/modules/gui/macosx/VLCMain.m b/modules/gui/macosx/VLCMain.m
index 033d555294..7d8af27f60 100644
--- a/modules/gui/macosx/VLCMain.m
+++ b/modules/gui/macosx/VLCMain.m
@@ -328,6 +328,7 @@ static VLCMain *sharedInstance = nil;
     b_intf_terminating = true;
 
     [_input_manager onPlaybackHasEnded:nil];
+    [_input_manager deinit];
 
     if (notification == nil)
         [[NSNotificationCenter defaultCenter] postNotificationName: NSApplicationWillTerminateNotification object: nil];



More information about the vlc-commits mailing list