Commit e9361438 authored by Clemens Werther's avatar Clemens Werther Committed by David

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's avatarDavid Fuhrmann <dfuhrmann@videolan.org>
parent b6c31714
......@@ -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
......@@ -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
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment