[vlc-commits] macosx: Fix quitting of VLC over quit menu item

David Fuhrmann git at videolan.org
Sat Oct 27 17:45:27 CEST 2018


vlc | branch: master | David Fuhrmann <dfuhrmann at videolan.org> | Sat Oct 27 17:41:02 2018 +0200| [874a3e7828879e1f588ff3bb5365328816adceaa] | committer: David Fuhrmann

macosx: Fix quitting of VLC over quit menu item

An event must be queued into the event loop so that the stop flag
can be executed and the main loop can be actually stopped.

If we we would have called the super implementation of this method
this would be not needed. But due to our custom deinit code in
Close, we do not call super, but instead do manual cleanup there.

closes #21369

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

 modules/gui/macosx/VLCApplication.m | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/modules/gui/macosx/VLCApplication.m b/modules/gui/macosx/VLCApplication.m
index f89e4a4513..d22936f346 100644
--- a/modules/gui/macosx/VLCApplication.m
+++ b/modules/gui/macosx/VLCApplication.m
@@ -39,11 +39,22 @@
 // but we need to send a stop: to properly exits libvlc.
 // However, we are not able to change the action-method sent by this standard menu item.
 // thus we override terminate: to send a stop:
-// see [af97f24d528acab89969d6541d83f17ce1ecd580] that introduced the removal of setjmp() and longjmp()
 - (void)terminate:(id)sender
 {
     [self activateIgnoringOtherApps:YES];
     [self stop:sender];
+
+    // Trigger event in loop to force evaluating the stop flag
+    NSEvent* event = [NSEvent otherEventWithType:NSApplicationDefined
+                                        location:NSMakePoint(0,0)
+                                   modifierFlags:0
+                                       timestamp:0.0
+                                    windowNumber:0
+                                         context:nil
+                                         subtype:0
+                                           data1:0
+                                           data2:0];
+    [NSApp postEvent:event atStart:YES];
 }
 
 @end



More information about the vlc-commits mailing list