]> git.sesse.net Git - vlc/commitdiff
macosx: Fix various crashes with the fspanel.
authorPierre d'Herbemont <pdherbemont@videolan.org>
Sun, 6 Jul 2008 19:35:33 +0000 (21:35 +0200)
committerPierre d'Herbemont <pdherbemont@videolan.org>
Sun, 6 Jul 2008 19:36:03 +0000 (21:36 +0200)
Fullscreen is working back.

modules/gui/macosx/fspanel.m

index 81766aca3f7f9124103bbb0cb84035a4685d4971..ae252bac01434738eb7005dc481ab2f474601286 100644 (file)
@@ -50,8 +50,8 @@
     [win setLevel:NSModalPanelWindowLevel];
     i_device = 0;
     [win center];
+    hideAgainTimer = fadeTimer = nil;
     [self setNonActive:nil];
-
     return win;
 }
 
@@ -94,7 +94,7 @@
 -(void)dealloc
 {
     [[NSNotificationCenter defaultCenter] removeObserver: self];
-    
+
     if( hideAgainTimer )
     {
         [hideAgainTimer invalidate];
     /* in case that the user don't want us to appear, just return here */
     if(! config_GetInt( VLCIntf, "macosx-fspanel" ) || b_nonActive )
         return;
-    
+
     [self orderFront: nil];
     
     if( [self alphaValue] < 1.0 || b_displayed != YES )
     /* get us a valid timer */
     if(! b_alreadyCounting )
     {
-        i_timeToKeepVisibleInSec = config_GetInt( VLCIntf, "mouse-hide-timeout" ) / 500;
-        hideAgainTimer = [NSTimer scheduledTimerWithTimeInterval: 0.5
+        i_timeToKeepVisibleInSec = var_CreateGetInteger( VLCIntf, "mouse-hide-timeout" ) / 500;
+        if( hideAgainTimer )
+        {
+            [hideAgainTimer invalidate];
+            [hideAgainTimer autorelease];
+        }
+        /* released in -autoHide and -dealloc */
+        hideAgainTimer = [[NSTimer scheduledTimerWithTimeInterval: 0.5
                                                           target: self 
                                                         selector: @selector(keepVisible:)
                                                         userInfo: nil 
-                                                         repeats: YES];
-        [hideAgainTimer fire];
-        [hideAgainTimer retain];
+                                                         repeats: YES] retain];
         b_alreadyCounting = YES;
     }
 }
         b_keptVisible = NO;
 
     /* count down until we hide ourselfes again and do so if necessary */
-    i_timeToKeepVisibleInSec -= 1;
-    if( i_timeToKeepVisibleInSec < 1 )
+    if( --i_timeToKeepVisibleInSec < 1 )
     {
         [NSCursor setHiddenUntilMouseMoves: YES];
         [self fadeOut];
-        [timer invalidate];
-        [timer release];
+        [hideAgainTimer invalidate]; /* released in -autoHide and -dealloc */
         b_alreadyCounting = NO;
-        timer = NULL;
     }
 }
 
 {
     [timer retain];
     [fadeTimer invalidate];
-    [fadeTimer release];
+    [fadeTimer autorelease];
     fadeTimer=timer;
 }