Mac OS X gui: Fix a double unlock issue, by making sure all timers are disabled when...
authorPierre d'Herbemont <pdherbemont@videolan.org>
Sat, 3 Mar 2007 13:22:03 +0000 (13:22 +0000)
committerPierre d'Herbemont <pdherbemont@videolan.org>
Sat, 3 Mar 2007 13:22:03 +0000 (13:22 +0000)
modules/gui/macosx/embeddedwindow.m

index 5c34e10..d007637 100644 (file)
     
     [self lockFullscreenAnimation];
 
-    /* This is a recursive lock. If we are already in the middle of an animation we
-     * unlock it. We don't add an extra locking here, because enter/leavefullscreen
-     * are executed always in the same thread */ 
-    if (b_animation_lock_alreadylocked)
-        [self unlockFullscreenAnimation];
-    b_animation_lock_alreadylocked = YES;
-
     if (!screen)
         screen = [self screen];
 
     {
         /* We were already fullscreen nothing to do when NSAnimation
          * is not supported */
-        [self unlockFullscreenAnimation];
         b_animation_lock_alreadylocked = NO;
+        [self unlockFullscreenAnimation];
         return;
     }
 
     /* We are in fullscreen (and no animation is running) */
     if (b_fullscreen)
     {
-        [self unlockFullscreenAnimation];
         b_animation_lock_alreadylocked = NO;
+        [self unlockFullscreenAnimation];
         return;
     }
 
         [o_fullscreen_anim2 release];
     }
  
+     /* This is a recursive lock. If we are already in the middle of an animation we
+     * unlock it. We don't add an extra locking here, because enter/leavefullscreen
+     * are executed always in the same thread */ 
+    if (b_animation_lock_alreadylocked)
+        [self unlockFullscreenAnimation];
+    b_animation_lock_alreadylocked = YES;
+
     if ([screen isMainScreen])
         SetSystemUIMode( kUIModeAllHidden, kUIOptionAutoShowMenuBar);
 
 
     [self lockFullscreenAnimation];
 
-    /* This is a recursive lock. If we are already in the middle of an animation we
-     * unlock it. We don't add an extra locking here, because enter/leavefullscreen
-     * are executed always in the same thread */ 
-    if (b_animation_lock_alreadylocked)
-        [self unlockFullscreenAnimation];
-    b_animation_lock_alreadylocked = YES;
-
     b_fullscreen = NO;
     [o_btn_fullscreen setState: NO];
 
     /* Don't do anything if o_fullscreen_window is already closed */
     if (!o_fullscreen_window)
     {
-        [self unlockFullscreenAnimation];
         b_animation_lock_alreadylocked = NO;
+        [self unlockFullscreenAnimation];
         return;
     }
 
         [o_fullscreen_anim2 release];
     }
 
+    /* This is a recursive lock. If we are already in the middle of an animation we
+     * unlock it. We don't add an extra locking here, because enter/leavefullscreen
+     * are executed always in the same thread */ 
+    if (b_animation_lock_alreadylocked)
+        [self unlockFullscreenAnimation];
+    b_animation_lock_alreadylocked = YES;
+
     frame = [[o_temp_view superview] convertRect: [o_temp_view frame] toView: nil]; /* Convert to Window base coord */
     frame.origin.x += [self frame].origin.x; 
     frame.origin.y += [self frame].origin.y;
 
     [o_fullscreen_window release];
     o_fullscreen_window = nil;
-    [self unlockFullscreenAnimation];
     b_animation_lock_alreadylocked = NO;
+    [self unlockFullscreenAnimation];
 }
 
 - (void)animationDidEnd:(NSAnimation*)animation