From dd5d1030b544187a5ba880be11c719d8ef7e6595 Mon Sep 17 00:00:00 2001 From: Corey Berla Date: Sun, 24 Jul 2022 20:53:41 -0700 Subject: [PATCH 1/2] mountoperation: Select "Anonymous" check button by default It is already explicitly assumed that anonymous authentication will be used when available, but it is not clear to the user since neither of the check buttons are selected. Select the Anonymous check button by default. --- gtk/gtkmountoperation.c | 1 + 1 file changed, 1 insertion(+) diff --git a/gtk/gtkmountoperation.c b/gtk/gtkmountoperation.c index 2d14523e63..87f2647849 100644 --- a/gtk/gtkmountoperation.c +++ b/gtk/gtkmountoperation.c @@ -678,6 +678,7 @@ gtk_mount_operation_ask_password_do_gtk (GtkMountOperation *operation, gtk_grid_attach (GTK_GRID (grid), anon_box, 1, rows++, 1, 1); choice = gtk_check_button_new_with_mnemonic (_("_Anonymous")); + gtk_check_button_set_active (GTK_CHECK_BUTTON (choice), TRUE); gtk_box_append (GTK_BOX (anon_box), choice); g_signal_connect (choice, "toggled", G_CALLBACK (pw_dialog_anonymous_toggled), operation); From 111929593aa995c3286b84ad118280357cfe6bdd Mon Sep 17 00:00:00 2001 From: Corey Berla Date: Sun, 24 Jul 2022 20:55:22 -0700 Subject: [PATCH 2/2] mountoperation: Free user_widgets list upon dialog destruction There's a list user_widgets that contains all of the entries and selections during authentication. This is only freed upon finalizing the GtkMountOperation. It's possible (and true for the GVFS SMB implementation) that a MountOperation can have the gtk_mount_operation_ask_password_do_gtk () function called multiple times (i.e. bad password). The user_widgets list grows with now invalid pointers to old widgets (causing unexpected behavior and seg faults). Free the user_widgets list upon dialog destruction, we don't need it anymore. Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5059 Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5058 --- gtk/gtkmountoperation.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gtk/gtkmountoperation.c b/gtk/gtkmountoperation.c index 87f2647849..90383811a1 100644 --- a/gtk/gtkmountoperation.c +++ b/gtk/gtkmountoperation.c @@ -400,6 +400,10 @@ pw_dialog_got_response (GtkDialog *dialog, else g_mount_operation_reply (op, G_MOUNT_OPERATION_ABORTED); + if (priv->user_widgets) + g_list_free (priv->user_widgets); + + priv->user_widgets = NULL; priv->dialog = NULL; g_object_notify (G_OBJECT (op), "is-showing"); gtk_window_destroy (GTK_WINDOW (dialog));