summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wang <chris.wang@sun.com>2008-04-29 13:33:39 +0000
committerThomas James Alexander Thurman <tthurman@src.gnome.org>2008-04-29 13:33:39 +0000
commit2d895ce87550908a813589b7b4c2c7c05533a90a (patch)
treea8afe6e157d4df3d6d8f04ea746d08abcb8d0300
parenteacd44278733eea025109ee0fe1420e450bda882 (diff)
downloadmetacity-2d895ce87550908a813589b7b4c2c7c05533a90a.tar.gz
XGetWindowAttributes can return an error value, and if it does its other
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) svn path=/trunk/; revision=3698
-rw-r--r--ChangeLog6
-rw-r--r--src/core/window.c37
2 files changed, 29 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index b531569a..c622fae8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+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)
+
2008-04-29 Thomas Thurman <tthurman@gnome.org>
* src/ui/fixedtip.[ch]: documentation
diff --git a/src/core/window.c b/src/core/window.c
index d1c32daf..90997a83 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -206,21 +206,30 @@ meta_window_new (MetaDisplay *display,
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);