summaryrefslogtreecommitdiff
path: root/gdk
diff options
context:
space:
mode:
authorRob Bradford <rob@linux.intel.com>2012-07-11 19:22:27 +0100
committerRob Bradford <rob@linux.intel.com>2012-07-12 15:58:38 +0100
commit91a11ee27735aadfcebb485c4e2240f3c3ab763b (patch)
treec205fc195e84702b2a8d88a49bb153aa04edeb87 /gdk
parent8bd14785966776aca589b59868a25394a5855a7e (diff)
downloadgtk+-91a11ee27735aadfcebb485c4e2240f3c3ab763b.tar.gz
wayland: Ensure we destroy the shell surface when destroying the surface
Otherwise we can try and use an invalid object that the compositor has already deleted.
Diffstat (limited to 'gdk')
-rw-r--r--gdk/wayland/gdkwindow-wayland.c33
1 files changed, 22 insertions, 11 deletions
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
index f1b79755c2..450df4a017 100644
--- a/gdk/wayland/gdkwindow-wayland.c
+++ b/gdk/wayland/gdkwindow-wayland.c
@@ -764,7 +764,11 @@ gdk_wayland_window_hide (GdkWindow *window)
if (impl->surface)
{
- wl_surface_destroy(impl->surface);
+ if (impl->shell_surface)
+ wl_shell_surface_destroy(impl->shell_surface);
+ if (impl->surface)
+ wl_surface_destroy(impl->surface);
+ impl->shell_surface = NULL;
impl->surface = NULL;
cairo_surface_destroy(impl->server_surface);
impl->server_surface = NULL;
@@ -788,13 +792,17 @@ gdk_window_wayland_withdraw (GdkWindow *window)
impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
if (impl->surface)
- {
- wl_surface_destroy(impl->surface);
- impl->surface = NULL;
- cairo_surface_destroy(impl->server_surface);
- impl->server_surface = NULL;
- impl->mapped = FALSE;
- }
+ {
+ if (impl->shell_surface)
+ wl_shell_surface_destroy(impl->shell_surface);
+ if (impl->surface)
+ wl_surface_destroy(impl->surface);
+ impl->shell_surface = NULL;
+ impl->surface = NULL;
+ cairo_surface_destroy(impl->server_surface);
+ impl->server_surface = NULL;
+ impl->mapped = FALSE;
+ }
}
}
@@ -1034,9 +1042,12 @@ gdk_wayland_window_destroy (GdkWindow *window,
if (!recursing && !foreign_destroy)
{
- if (GDK_WINDOW_IMPL_WAYLAND (window->impl)->surface)
- wl_surface_destroy(GDK_WINDOW_IMPL_WAYLAND (window->impl)->surface);
- wl_shell_surface_destroy(GDK_WINDOW_IMPL_WAYLAND (window->impl)->shell_surface);
+ if (impl->shell_surface)
+ wl_shell_surface_destroy(impl->shell_surface);
+ if (impl->surface)
+ wl_surface_destroy(impl->surface);
+ impl->shell_surface = NULL;
+ impl->surface = NULL;
}
}