GNOME Bugzilla – Bug 778190
Gdk-CRITICAL when GtkScrolledWindow unsetting scroll cursor
Last modified: 2018-05-02 18:02:57 UTC
Since Bug 753202 landed, I'm now getting a Gdk-CRITICAL when GtkScrolledWindow unsets the scroll cursor, after a WebKitGTK+ web view has been removed from the toplevel's widget hierarchy. This may be related to how WebKitGTK+ handles events (see https://bugs.webkit.org/show_bug.cgi?id=136430#c1) but I think it might happen any time a widget with a GDK window has been removed before the cursor is unset. In any case, GtkScrolledWindow probably shouldn't crash. Representative stack error and stack trace below, but looking at the value of priv->scroll_window, in the call to uninstall_scroll_cursor (#5 in the stack below), I get the following: > (gdb) print priv->scroll_window.state > $12 = GDK_WINDOW_STATE_WITHDRAWN > (gdb) print priv->scroll_window.parent > $13 = 0x0 > (gdb) print priv->scroll_window.destroyed > $14 = 1 Maybe an an extra test should be added to uninstall_scroll_cursor? I'll look into getting a patch to fix this. (geary:16329): Gdk-CRITICAL **: gdk_window_set_cursor: assertion 'GDK_IS_WINDOW (window)' failed Thread 1 "geary" received signal SIGTRAP, Trace/breakpoint trap. _g_log_abort (breakpoint=breakpoint@entry=1) at ././glib/gmessages.c:487 487 ././glib/gmessages.c: No such file or directory. (gdb) bt
+ Trace 237106
Created attachment 344963 [details] [review] Fix Gdk-CRITICAL when GtkScrolledWindow unsetting scroll cursor Patch against gtk-3-22, can no longer seem to repro the problem with it applied.
Definitely not WebKitGTK-related, just had basically the same happen after a GtkListBox was removed from a GtkScrolledWindow's viewport. Any chance of getting a review for the patch?
Review of attachment 344963 [details] [review]: ::: gtk/gtkscrolledwindow.c @@ +3411,3 @@ + { + gdk_window_set_cursor (priv->scroll_window, priv->scroll_cursor); + } This makes me a bit uncomfortable - if the window can be destroyed, it is quite likely that we are looking at a dangling pointer here and access freed memory. Do we need to use a weak ref ? There's also some formatting issues here (space before (, and redundant {} )
Created attachment 346034 [details] [review] Use weak ref to clear scrolled window Thanks for the review. Updated patch uses a weak ref that clears the window and also the cursor, and further now ensures that also happens on destroy, so we don't leak the cursor if it hasn't been uninstalled.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gtk/issues/749.