[vlc-commits] macosx: Implement different way to always store playback position
David Fuhrmann
git at videolan.org
Sun Mar 18 21:16:48 CET 2018
vlc/vlc-3.0 | branch: master | David Fuhrmann <dfuhrmann at videolan.org> | Sun Mar 18 18:55:19 2018 +0100| [b5e8b9a09ff2fce070ce959c1d67878a9b3a03e0] | committer: Jean-Baptiste Kempf
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
(cherry picked from commit 2c0ea2ff607aa19defdb14ade9caa074cc115c9e)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=b5e8b9a09ff2fce070ce959c1d67878a9b3a03e0
---
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 bdc115cef7..fbc75690c9 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 65b5e4306f..8397c0fb5c 100644
--- a/modules/gui/macosx/VLCMain.m
+++ b/modules/gui/macosx/VLCMain.m
@@ -327,6 +327,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