[mutter/gnome-3-8] compositor: Prevent an error in application code from keeping unredirect on permanently



commit 7b36dcf4a06bbb69231ab360356c269f9e7ccce8
Author: Adel Gadllah <adel gadllah gmail com>
Date:   Tue Jun 18 21:36:20 2013 +0200

    compositor: Prevent an error in application code from keeping unredirect on permanently
    
    We substract one from the unredirect counter when enable_unredirect_for_screen
    gets called. It is an unsigned integer so substracting one from zero (which means enable) would overflow 
and thus keep it peramently enabled.
    
    This should never happen because it means there is an unmatched
    enable / disable pair somewhere. So in addition to fixing it add a
    warning when this case gets triggered.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=701224

 src/compositor/compositor.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c
index f130947..642b651 100644
--- a/src/compositor/compositor.c
+++ b/src/compositor/compositor.c
@@ -1567,8 +1567,10 @@ void
 meta_enable_unredirect_for_screen (MetaScreen *screen)
 {
   MetaCompScreen *info = meta_screen_get_compositor_data (screen);
-  if (info != NULL)
-   info->disable_unredirect_count = MAX(0, info->disable_unredirect_count - 1);
+  if (info != NULL && info->disable_unredirect_count == 0)
+    g_warning ("Called enable_unredirect_for_screen while unredirection is enabled.");
+  if (info != NULL && info->disable_unredirect_count > 0)
+   info->disable_unredirect_count = info->disable_unredirect_count - 1;
 }
 
 #define FLASH_TIME_MS 50


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]