metacity r3698 - in trunk: . src/core



Author: tthurman
Date: Tue Apr 29 13:33:39 2008
New Revision: 3698
URL: http://svn.gnome.org/viewvc/metacity?rev=3698&view=rev

Log:
2008-04-29  Chris Wang  <chris wang sun com>

        * src/core/window.c (meta_window_new): XGetWindowAttributes
          can return an error value, and if it does its other results
          are invalid! (#530485)



Modified:
   trunk/ChangeLog
   trunk/src/core/window.c

Modified: trunk/src/core/window.c
==============================================================================
--- trunk/src/core/window.c	(original)
+++ trunk/src/core/window.c	Tue Apr 29 13:33:39 2008
@@ -206,21 +206,30 @@
   
   meta_error_trap_push_with_return (display);
   
-  XGetWindowAttributes (display->xdisplay,
-                        xwindow, &attrs);
-  
-  if (meta_error_trap_pop_with_return (display, TRUE) != Success)
-    {
-      meta_verbose ("Failed to get attributes for window 0x%lx\n",
-                    xwindow);
-      meta_error_trap_pop (display, TRUE);
-      meta_display_ungrab (display);
-      return NULL;
-    }
-  window = meta_window_new_with_attrs (display, xwindow,
+  if (XGetWindowAttributes (display->xdisplay,xwindow, &attrs)) 
+   {
+      if(meta_error_trap_pop_with_return (display, TRUE) != Success)
+       {
+          meta_verbose ("Failed to get attributes for window 0x%lx\n",
+                        xwindow);
+          meta_error_trap_pop (display, TRUE);
+          meta_display_ungrab (display);
+          return NULL;
+       }
+      window = meta_window_new_with_attrs (display, xwindow,
                                        must_be_viewable, &attrs);
-
-
+   }
+  else
+   {
+         meta_error_trap_pop_with_return (display, TRUE); 
+         meta_verbose ("Failed to get attributes for window 0x%lx\n",
+                        xwindow);
+         meta_error_trap_pop (display, TRUE);
+         meta_display_ungrab (display);
+         return NULL;
+   }
+   
+  
   meta_error_trap_pop (display, FALSE);
   meta_display_ungrab (display);
 



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