summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Holy <oholy@redhat.com>2021-04-21 09:41:01 +0200
committerOndrej Holy <oholy@redhat.com>2021-04-21 12:37:35 +0200
commit545ca995afd39c475e5f78b3bfb0a7053cdc0964 (patch)
tree13edb1e8b4e795227dc246de106cf060db2df502
parent7357936ea26ca966c8f8c9882bd96a0087ada21d (diff)
downloadnautilus-wip/oholy/encrypted-archive-crashes.tar.gz
file-operations: Return NULL if password dialog was cancelledwip/oholy/encrypted-archive-crashes
Currently, an empty string is passed to gnome-autoar if the archive extraction password dialog is cancelled. This is not problem currently as immediately the `abort_job` function is called, however, it would be nice to return `NULL` to make obvious that the prompt dialog was cancelled. https://gitlab.gnome.org/GNOME/nautilus/-/merge_requests/657#note_1084750
-rw-r--r--src/nautilus-file-operations.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/nautilus-file-operations.c b/src/nautilus-file-operations.c
index 09424b139..59beecd7e 100644
--- a/src/nautilus-file-operations.c
+++ b/src/nautilus-file-operations.c
@@ -8372,6 +8372,7 @@ typedef struct
GtkWidget *passphrase_entry;
GMutex mutex;
GCond cond;
+ gboolean completed;
} PassphraseRequestData;
static void
@@ -8386,8 +8387,12 @@ on_request_passphrase_cb (GtkDialog *dialog,
{
abort_job ((CommonJob *) data->extract_job);
}
+ else
+ {
+ data->passphrase = g_strdup (gtk_entry_get_text (GTK_ENTRY (data->passphrase_entry)));
+ }
- data->passphrase = g_strdup (gtk_entry_get_text (GTK_ENTRY (data->passphrase_entry)));
+ data->completed = TRUE;
gtk_widget_destroy (GTK_WIDGET (dialog));
@@ -8467,7 +8472,7 @@ extract_job_on_request_passphrase (AutoarExtractor *extractor,
run_passphrase_dialog,
data);
- while (data->passphrase == NULL)
+ while (!data->completed)
{
g_cond_wait (&data->cond, &data->mutex);
}