After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 767849 - crash in focus handling
crash in focus handling
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: .General
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2016-06-20 02:39 UTC by Matthias Clasen
Modified: 2016-06-21 15:59 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GtkColorEditor: Keep ref on pre-popup focus widget (2.74 KB, patch)
2016-06-21 12:04 UTC, Carlos Garnacho
committed Details | Review

Description Matthias Clasen 2016-06-20 02:39:18 UTC
open the color chooser example in gtk3-demo, go to the color editor, bring up a popover by holding down left button on one of the sliders. Then click in the color pane to move the focus there, and hit Escape:

Thread 1 "lt-gtk3-demo" received signal SIGSEGV, Segmentation fault.
0x00007ffff78621c5 in _gtk_widget_get_parent (widget=0xcec4b0)
    at gtkwidgetprivate.h:321
321	  return widget->priv->parent;

(gdb) bt
  • #0 _gtk_widget_get_parent
    at gtkwidgetprivate.h line 321
  • #1 gtk_window_set_focus
    at gtkwindow.c line 2582
  • #2 gtk_window_dispose
    at gtkwindow.c line 3127
  • #3 g_object_unref
    at gobject.c line 3146
  • #4 gtk_main_do_event
    at gtkmain.c line 1788
  • #5 send_delete_event
    at gtkwindow.c line 1321
  • #6 gdk_threads_dispatch
    at gdk.c line 741
  • #7 g_idle_dispatch
    at gmain.c line 5452
  • #8 g_main_dispatch
    at gmain.c line 3165
  • #9 g_main_context_dispatch
    at gmain.c line 3780
  • #10 g_main_context_iterate
    at gmain.c line 3851
  • #11 g_main_context_iteration
    at gmain.c line 3912
  • #12 g_application_run
    at gapplication.c line 2381
  • #13 main
    at main.c line 1180

Comment 1 Carlos Garnacho 2016-06-21 12:04:38 UTC
Created attachment 330128 [details] [review]
GtkColorEditor: Keep ref on pre-popup focus widget

And ensure it's still visible before returning the keyboard focus to it.
Because of the extra ref, add a dispose handler that will ensure the
ref is lost (by popping down), although this should be already ensured
through other paths (eg. when the popup widget loses visibility).

This fixes a possible crash in dispose paths, where we might be restoring
focus on an already destroyed widget, and at a time where, if the toplevel
is being itself disposed, no new focus should be set.
Comment 2 Matthias Clasen 2016-06-21 15:18:50 UTC
Review of attachment 330128 [details] [review]:

ok
Comment 3 Carlos Garnacho 2016-06-21 15:59:02 UTC
Attachment 330128 [details] pushed as f44b9ef - GtkColorEditor: Keep ref on pre-popup focus widget