[gtk+] wayland: Make display closing work
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] wayland: Make display closing work
- Date: Fri, 28 Aug 2015 20:16:02 +0000 (UTC)
commit ea66300cf94f01aa0983579b49447fc15b340f83
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Aug 28 14:16:21 2015 -0400
wayland: Make display closing work
The code in _gdk_wayland_window_dispose was not safe against
being called twice - it would call g_hash_table_destroy twice
on the known_globals hash table, the second time operating on
freed memory. It was also leaking the list of async_roundtrips.
After fixing both of these issues, the displayclose testcase
now works on Wayland.
gdk/wayland/gdkdisplay-wayland.c | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c
index d1c58de..64529fb 100644
--- a/gdk/wayland/gdkdisplay-wayland.c
+++ b/gdk/wayland/gdkdisplay-wayland.c
@@ -86,7 +86,7 @@ async_roundtrip_callback (void *data,
wl_callback_destroy (callback);
}
-static const struct wl_callback_listener async_roundrip_listener = {
+static const struct wl_callback_listener async_roundtrip_listener = {
async_roundtrip_callback
};
@@ -97,7 +97,7 @@ _gdk_wayland_display_async_roundtrip (GdkWaylandDisplay *display_wayland)
callback = wl_display_sync (display_wayland->wl_display);
wl_callback_add_listener (callback,
- &async_roundrip_listener,
+ &async_roundtrip_listener,
display_wayland);
display_wayland->async_roundtrips =
g_list_append (display_wayland->async_roundtrips, callback);
@@ -508,10 +508,14 @@ gdk_wayland_display_dispose (GObject *object)
display_wayland->selection = NULL;
}
- g_list_foreach (display_wayland->async_roundtrips,
- (GFunc) wl_callback_destroy, NULL);
+ g_list_free_full (display_wayland->async_roundtrips, (GDestroyNotify) wl_callback_destroy);
+
+ if (display_wayland->known_globals)
+ {
+ g_hash_table_destroy (display_wayland->known_globals);
+ display_wayland->known_globals = NULL;
+ }
- g_hash_table_destroy (display_wayland->known_globals);
g_list_free_full (display_wayland->on_has_globals_closures, g_free);
G_OBJECT_CLASS (gdk_wayland_display_parent_class)->dispose (object);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]