summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2010-03-16 12:35:13 -0400
committerMatthias Clasen <mclasen@redhat.com>2010-03-16 12:35:13 -0400
commit996541d096d4d59e9baa384e5d5359a10567433e (patch)
tree11174c5a8195cac8fe2b02aca3f63f7ed2d9db88
parente9b4d7c69b3d82721d34fe00b37cec35df10c148 (diff)
downloadgtk+-996541d096d4d59e9baa384e5d5359a10567433e.tar.gz
Don't crash in DND when the X server doesn't support SHAPE
Reported in bug 612768
-rw-r--r--gdk/x11/gdkwindow-x11.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
index 455a88bf2e..f7789d4ef4 100644
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@ -4604,14 +4604,18 @@ _xwindow_get_shape (Display *xdisplay,
gint rn, ord, i;
shape = NULL;
-
+ rn = 0;
+
xrl = XShapeGetRectangles (xdisplay,
window,
shape_type, &rn, &ord);
-
+
+ if (xrl == NULL)
+ return NULL; /* XShape not supported */
+
if (rn == 0)
return gdk_region_new (); /* Empty */
-
+
if (ord != YXBanded)
{
/* This really shouldn't happen with any xserver, as they
@@ -4648,21 +4652,20 @@ _gdk_windowing_get_shape_for_mask (GdkBitmap *mask)
display = gdk_drawable_get_display (GDK_DRAWABLE (mask));
window = XCreateSimpleWindow (GDK_DISPLAY_XDISPLAY (display),
- GDK_SCREEN_XROOTWIN (gdk_display_get_default_screen (display)),
- -1, -1, 1, 1, 0,
- 0, 0);
+ GDK_SCREEN_XROOTWIN (gdk_display_get_default_screen (display)),
+ -1, -1, 1, 1, 0,
+ 0, 0);
XShapeCombineMask (GDK_DISPLAY_XDISPLAY (display),
- window,
- ShapeBounding,
- 0, 0,
- GDK_PIXMAP_XID (mask),
- ShapeSet);
-
+ window,
+ ShapeBounding,
+ 0, 0,
+ GDK_PIXMAP_XID (mask),
+ ShapeSet);
+
region = _xwindow_get_shape (GDK_DISPLAY_XDISPLAY (display),
- window, ShapeBounding);
+ window, ShapeBounding);
- XDestroyWindow (GDK_DISPLAY_XDISPLAY (display),
- window);
+ XDestroyWindow (GDK_DISPLAY_XDISPLAY (display), window);
return region;
}