filechooser: Prevent recursion when activating items
authorMatthias Clasen <mclasen@redhat.com>
Mon, 10 Oct 2022 23:25:45 +0000 (19:25 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 21 Oct 2022 02:34:40 +0000 (22:34 -0400)
When a list item is activated, we activate the default widget.
Unfortunately, due to some other bug, sometimes the open button
is not made sensitive, and then default.activate falls back
to activating the focus widget (which is the item we are just
coming from). Boom

gtk/gtkfilechooserwidget.c

index e3070b08b97e1ed4fc64895014a73041ce2cafe8..4f3c30d399d5c77b9946bda7f58e7fa3bb1819c0 100644 (file)
@@ -6298,7 +6298,10 @@ column_view_row_activated_cb (GtkColumnView        *column_view,
   else if (self->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
            self->action == GTK_FILE_CHOOSER_ACTION_SAVE)
     {
+      /* prevent recursion */
+      g_signal_handlers_block_by_func (column_view, column_view_row_activated_cb, self);
       gtk_widget_activate_default (GTK_WIDGET (self));
+      g_signal_handlers_unblock_by_func (column_view, column_view_row_activated_cb, self);
     }
 
   g_clear_object (&info);