GNOME Bugzilla – Bug 757036
focus-out-event called a few more times when the widget is removed in the focus-out-event handler
Last modified: 2018-04-14 23:58:41 UTC
Created attachment 313968 [details] Python script showing the bug Run the attached script, notice the entry is focused, click in another window, notice "out" printed 5 more times, along with some warnings: $ python bug.py sys:1: PyGIWarning: Gtk was imported without specifying a version first. Use gi.require_version('Gtk', '3.0') before import to ensure that the right version gets loaded. (bug.py:20318): IBUS-WARNING **: Unable to connect to ibus: Could not connect: Connection refused in out <gtk.gdk.X11Window object at 0x7fd55f737510 (GdkX11Window at 0x1af22e0)> <Box object at 0x7fd569accf30 (GtkBox at 0x1b39110)> out None None (bug.py:20318): Gtk-CRITICAL **: gtk_container_remove: assertion '_gtk_widget_get_parent (widget) == GTK_WIDGET (container) || GTK_IS_ASSISTANT (container) || GTK_IS_ACTION_BAR (container) || GTK_IS_POPOVER_MENU (container)' failed out None None (bug.py:20318): Gtk-CRITICAL **: gtk_container_remove: assertion '_gtk_widget_get_parent (widget) == GTK_WIDGET (container) || GTK_IS_ASSISTANT (container) || GTK_IS_ACTION_BAR (container) || GTK_IS_POPOVER_MENU (container)' failed out None None (bug.py:20318): Gtk-CRITICAL **: gtk_container_remove: assertion '_gtk_widget_get_parent (widget) == GTK_WIDGET (container) || GTK_IS_ASSISTANT (container) || GTK_IS_ACTION_BAR (container) || GTK_IS_POPOVER_MENU (container)' failed out None None (bug.py:20318): Gtk-CRITICAL **: gtk_container_remove: assertion '_gtk_widget_get_parent (widget) == GTK_WIDGET (container) || GTK_IS_ASSISTANT (container) || GTK_IS_ACTION_BAR (container) || GTK_IS_POPOVER_MENU (container)' failed out None None (bug.py:20318): Gtk-CRITICAL **: gtk_container_remove: assertion '_gtk_widget_get_parent (widget) == GTK_WIDGET (container) || GTK_IS_ASSISTANT (container) || GTK_IS_ACTION_BAR (container) || GTK_IS_POPOVER_MENU (container)' failed
Changing the widget hierarchy in focus-in or focus-out is not a good idea.
widget.props.has_focus is already False. Maybe it could be taken into consideration when deciding whether to trigger the signal.
We're moving to gitlab! As part of this move, we are moving bugs to NEEDINFO if they haven't seen activity in more than a year. If this issue is still important to you and still relevant with GTK+ 3.22 or master, please reopen it and we will migrate it to gitlab.
As announced a while ago, we are migrating to gitlab, and bugs that haven't seen activity in the last year or so will be not be migrated, but closed out in bugzilla. If this bug is still relevant to you, you can open a new issue describing the symptoms and how to reproduce it with gtk 3.22.x or master in gitlab: https://gitlab.gnome.org/GNOME/gtk/issues/new