[gtk+] Wayland: fix a crash in opaque region handling



commit 73bae5b816e3f55fc3bd85f10c406966a75443ed
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Oct 15 18:19:22 2013 -0400

    Wayland: fix a crash in opaque region handling
    
    We may get a NULL region passed to the backend, which means
    'nothing is opaque'. In that case, don't crash, but pass
    the information on to the compositor.
    
    http://bugzilla.gnome.org/show_bug.cgi?id=709854

 gdk/wayland/gdkwindow-wayland.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
index d0aac90..b5e9036 100644
--- a/gdk/wayland/gdkwindow-wayland.c
+++ b/gdk/wayland/gdkwindow-wayland.c
@@ -2070,7 +2070,7 @@ gdk_wayland_window_set_opaque_region (GdkWindow      *window,
                                       cairo_region_t *region)
 {
   GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
-  struct wl_region *wl_region;
+  struct wl_region *wl_region = NULL;
 
   if (GDK_WINDOW_DESTROYED (window))
     return;
@@ -2078,12 +2078,13 @@ gdk_wayland_window_set_opaque_region (GdkWindow      *window,
   if (!impl->surface)
     gdk_wayland_window_create_surface (window);
 
-  wl_region = wl_region_from_cairo_region (GDK_WAYLAND_DISPLAY (gdk_window_get_display (window)), region);
-  if (wl_region == NULL)
-    return;
+  if (region != NULL)
+    wl_region = wl_region_from_cairo_region (GDK_WAYLAND_DISPLAY (gdk_window_get_display (window)), region);
 
   wl_surface_set_opaque_region (impl->surface, wl_region);
-  wl_region_destroy (wl_region);
+
+  if (wl_region != NULL)
+    wl_region_destroy (wl_region);
 }
 
 


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