vlc | branch: master | Felix Paul Kühne <[email protected]> | Fri Jan 20 
11:41:23 2012 -0800| [3d7351e61608abf3aa724883aff20cff59b3b673] | committer: 
Felix Paul Kühne

macosx: make sure that NSApplicationWillTerminateNotification reaches all of 
its observers

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

 modules/gui/macosx/MainWindow.m |   42 ++++++++++++++++++++++----------------
 modules/gui/macosx/intf.m       |    3 ++
 2 files changed, 27 insertions(+), 18 deletions(-)

diff --git a/modules/gui/macosx/MainWindow.m b/modules/gui/macosx/MainWindow.m
index 8d6ccbe..4f072f3 100644
--- a/modules/gui/macosx/MainWindow.m
+++ b/modules/gui/macosx/MainWindow.m
@@ -112,8 +112,6 @@ static VLCMainWindow *_o_sharedInstance = nil;
         [o_color_backdrop release];
 
     [[NSNotificationCenter defaultCenter] removeObserver: self];
-    config_PutInt( VLCIntf->p_libvlc, "volume", i_lastShownVolume );
-    [self saveFrameUsingName: [self frameAutosaveName]];
     [o_sidebaritems release];
     [super dealloc];
 }
@@ -427,12 +425,13 @@ static VLCMainWindow *_o_sharedInstance = nil;
         winrect.size.height = winrect.size.height - f_titleBarHeight;
         [o_split_view setFrame: winrect];
         [o_video_view setFrame: winrect];
-        previousSavedFrame = winrect;
 
         o_color_backdrop = [[VLCColorView alloc] initWithFrame: [o_split_view 
frame]];
         [[self contentView] addSubview: o_color_backdrop positioned: 
NSWindowBelow relativeTo: o_split_view];
         [o_color_backdrop setAutoresizingMask:NSViewHeightSizable | 
NSViewWidthSizable];
 
+        previousSavedFrame = winrect;
+
         [self display];
     }
     else
@@ -459,6 +458,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
 
     [[NSNotificationCenter defaultCenter] addObserver: self selector: 
@selector(someWindowWillClose:) name: NSWindowWillCloseNotification object: 
nil];
     [[NSNotificationCenter defaultCenter] addObserver: self selector: 
@selector(someWindowWillMiniaturize:) name: NSWindowWillMiniaturizeNotification 
object:nil];
+    [[NSNotificationCenter defaultCenter] addObserver: self selector: 
@selector(applicationWillTerminate:) name: 
NSApplicationWillTerminateNotification object: nil];
 }
 
 #pragma mark -
@@ -894,6 +894,27 @@ static VLCMainWindow *_o_sharedInstance = nil;
     [self saveFrameUsingName: [self frameAutosaveName]];
 }
 
+- (void)applicationWillTerminate:(NSNotification *)notification
+{
+    config_PutInt( VLCIntf->p_libvlc, "volume", i_lastShownVolume );
+    [self saveFrameUsingName: [self frameAutosaveName]];
+}
+
+- (void)someWindowWillClose:(NSNotification *)notification
+{
+    if([notification object] == o_nonembedded_window || [notification object] 
== self)
+        [[VLCCoreInteraction sharedInstance] stop];
+}
+
+- (void)someWindowWillMiniaturize:(NSNotification *)notification
+{
+    if([notification object] == o_nonembedded_window || [notification object] 
== self)
+    {
+        if([[VLCMain sharedInstance] activeVideoPlayback])
+            [[VLCCoreInteraction sharedInstance] pause];
+    }
+}
+
 #pragma mark -
 #pragma mark Update interface and respond to foreign events
 - (void)showDropZone
@@ -1264,21 +1285,6 @@ static VLCMainWindow *_o_sharedInstance = nil;
     [NSCursor setHiddenUntilMouseMoves: YES];
 }
 
-- (void)someWindowWillClose:(NSNotification *)notification
-{
-    if([notification object] == o_nonembedded_window || [notification object] 
== self)
-        [[VLCCoreInteraction sharedInstance] stop];
-}
-
-- (void)someWindowWillMiniaturize:(NSNotification *)notification
-{
-    if([notification object] == o_nonembedded_window || [notification object] 
== self)
-    {
-        if([[VLCMain sharedInstance] activeVideoPlayback])
-            [[VLCCoreInteraction sharedInstance] pause];
-    }
-}
-
 #pragma mark -
 #pragma mark Fullscreen support
 - (void)showFullscreenController
diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m
index db9d5c1..8ebadee 100644
--- a/modules/gui/macosx/intf.m
+++ b/modules/gui/macosx/intf.m
@@ -678,6 +678,9 @@ static VLCMain *_o_sharedMainInstance = nil;
 
 - (void)applicationWillTerminate:(NSNotification *)notification
 {
+    if (notification == nil)
+        [[NSNotificationCenter defaultCenter] postNotificationName: 
NSApplicationWillTerminateNotification object: nil];
+
     playlist_t * p_playlist;
     vout_thread_t * p_vout;
     int returnedValue = 0;

_______________________________________________
vlc-commits mailing list
[email protected]
http://mailman.videolan.org/listinfo/vlc-commits

Reply via email to