x11: Don't use g_hash_table_steal()
authorBenjamin Otte <otte@redhat.com>
Sat, 4 Nov 2017 00:35:59 +0000 (01:35 +0100)
committerBenjamin Otte <otte@redhat.com>
Sat, 4 Nov 2017 00:35:59 +0000 (01:35 +0100)
It returns TRUE/FALSE, not the item you've stolen, so if you free that,
your X connections is gonna have a BadCursor.

gdk/x11/gdkcursor-x11.c

index ec9db4a8a78391f0514d09a1370242a0a0e1cf76..d7069f450faec177343a4817e3e7389af086e752 100644 (file)
@@ -49,8 +49,9 @@ gdk_x11_cursor_remove_from_cache (gpointer data, GObject *cursor)
   GdkDisplay *display = data;
   Cursor xcursor;
 
-  xcursor = GDK_POINTER_TO_XID (g_hash_table_steal (GDK_X11_DISPLAY (display)->cursors, cursor));
+  xcursor = GDK_POINTER_TO_XID (g_hash_table_lookup (GDK_X11_DISPLAY (display)->cursors, cursor));
   XFreeCursor (GDK_DISPLAY_XDISPLAY (display), xcursor);
+  g_hash_table_remove (GDK_X11_DISPLAY (display)->cursors, cursor);
 }
 
 void