[vlc-commits] macosx: cancel the resume dialog after switching playlist items
Clemens Werther
git at videolan.org
Sun Jul 3 19:29:35 CEST 2016
vlc | branch: master | Clemens Werther <clemenswerther at googlemail.com> | Fri Jul 1 01:06:24 2016 +0400| [e9361438426441e1b4d4c8a5471c06282c9b8ffc] | committer: David Fuhrmann
macosx: cancel the resume dialog after switching playlist items
fix bug where VLC segfaults on OSX: After switching a playlist item
while presented a resume dialog, the resume dialog still shows for
the previous item. Clicking "continue" crashes VLC.
Signed-off-by: David Fuhrmann <dfuhrmann at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e9361438426441e1b4d4c8a5471c06282c9b8ffc
---
modules/gui/macosx/ResumeDialogController.h | 4 ++++
modules/gui/macosx/ResumeDialogController.m | 25 +++++++++++++++----------
modules/gui/macosx/VLCPlaylist.m | 2 ++
3 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/modules/gui/macosx/ResumeDialogController.h b/modules/gui/macosx/ResumeDialogController.h
index cb2b8e2..08c6fb9 100644
--- a/modules/gui/macosx/ResumeDialogController.h
+++ b/modules/gui/macosx/ResumeDialogController.h
@@ -41,6 +41,8 @@ typedef void(^CompletionBlock)(enum ResumeResult);
IBOutlet id o_restart_btn;
IBOutlet id o_resume_btn;
IBOutlet id o_always_resume_chk;
+
+ NSTimer *o_countdown_timer;
}
- (IBAction)buttonClicked:(id)sender;
@@ -50,4 +52,6 @@ typedef void(^CompletionBlock)(enum ResumeResult);
- (void)updateCocoaWindowLevel:(NSInteger)i_level;
+- (void)cancel;
+
@end
diff --git a/modules/gui/macosx/ResumeDialogController.m b/modules/gui/macosx/ResumeDialogController.m
index 323764d..1dc0a5a 100644
--- a/modules/gui/macosx/ResumeDialogController.m
+++ b/modules/gui/macosx/ResumeDialogController.m
@@ -55,11 +55,6 @@
{
NSWindow *w = [self window];
- if ([w isVisible]) {
- msg_Err(getIntf(), "Resume dialog in use already");
- return;
- }
-
currentResumeTimeout = 10;
completionBlock = [block copy];
@@ -75,11 +70,11 @@
[o_text_lbl setStringValue:labelString];
[o_always_resume_chk setState: NSOffState];
- NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:1
- target:self
- selector:@selector(updateAlertWindow:)
- userInfo:nil
- repeats:YES];
+ o_countdown_timer = [NSTimer scheduledTimerWithTimeInterval:1
+ target:self
+ selector:@selector(updateAlertWindow:)
+ userInfo:nil
+ repeats:YES];
[w setLevel:[[[VLCMain sharedInstance] voutController] currentStatusWindowLevel]];
[w center];
@@ -132,4 +127,14 @@
[self.window setLevel: i_level];
}
+- (void)cancel
+{
+ if (o_countdown_timer != nil) {
+ [o_countdown_timer invalidate];
+ o_countdown_timer = nil;
+ }
+
+ [[self window] close];
+}
+
@end
diff --git a/modules/gui/macosx/VLCPlaylist.m b/modules/gui/macosx/VLCPlaylist.m
index d71c133..1c439bf 100644
--- a/modules/gui/macosx/VLCPlaylist.m
+++ b/modules/gui/macosx/VLCPlaylist.m
@@ -867,6 +867,8 @@
- (void)continuePlaybackWhereYouLeftOff:(input_thread_t *)p_input_thread
{
+ [[[VLCMain sharedInstance] resumeDialog] cancel];
+
NSDictionary *recentlyPlayedFiles = [[NSUserDefaults standardUserDefaults] objectForKey:@"recentlyPlayedMedia"];
if (!recentlyPlayedFiles)
return;
More information about the vlc-commits
mailing list