[evolution] Crash after import file disappears before import is done
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Crash after import file disappears before import is done
- Date: Mon, 9 Oct 2017 09:07:38 +0000 (UTC)
commit 8f9e703ed56c0a7101c41a1b37d4f6c9a37edde2
Author: Milan Crha <mcrha redhat com>
Date: Mon Oct 9 11:05:40 2017 +0200
Crash after import file disappears before import is done
The problem was that the e-import-assistant.c:prepare_progress_page()
could finish import before this function call is done, but it is
called by the GtkAssistant, thus the import finish freed the assistant
structure while it had been still in use by the call stack.
This had been reported downstream at:
https://bugzilla.redhat.com/show_bug.cgi?id=1498675
src/e-util/e-import-assistant.c | 39 ++++++++++++++++++++++++++++++++-------
1 files changed, 32 insertions(+), 7 deletions(-)
---
diff --git a/src/e-util/e-import-assistant.c b/src/e-util/e-import-assistant.c
index 1d765d7..2372f4e 100644
--- a/src/e-util/e-import-assistant.c
+++ b/src/e-util/e-import-assistant.c
@@ -758,6 +758,32 @@ prepare_destination_page (GtkAssistant *assistant,
return FALSE;
}
+typedef struct _ProgressData {
+ EImportAssistant *assistant;
+ EImportCompleteFunc done;
+} ProgressData;
+
+static gboolean
+run_import_progress_page_idle (gpointer user_data)
+{
+ ProgressData *pd = user_data;
+
+ g_return_val_if_fail (pd != NULL, FALSE);
+
+ if (pd->done)
+ e_import_import (
+ pd->assistant->priv->import, pd->assistant->priv->import_target,
+ pd->assistant->priv->import_importer, import_status,
+ pd->done, pd->assistant);
+ else
+ import_assistant_finished (pd->assistant, NULL);
+
+ g_object_unref (pd->assistant);
+ g_free (pd);
+
+ return FALSE;
+}
+
static void
prepare_progress_page (GtkAssistant *assistant,
GtkWidget *vbox)
@@ -766,6 +792,7 @@ prepare_progress_page (GtkAssistant *assistant,
EImportCompleteFunc done = NULL;
ImportSelectionPage *page;
GtkWidget *cancel_button;
+ ProgressData *pd;
gboolean intelligent_import;
gboolean is_simple = FALSE;
@@ -809,13 +836,11 @@ prepare_progress_page (GtkAssistant *assistant,
}
}
- if (done)
- e_import_import (
- priv->import, priv->import_target,
- priv->import_importer, import_status,
- done, assistant);
- else
- import_assistant_finished (E_IMPORT_ASSISTANT (assistant), NULL);
+ pd = g_new0 (ProgressData, 1);
+ pd->assistant = g_object_ref (assistant);
+ pd->done = done;
+
+ g_idle_add_full (G_PRIORITY_HIGH_IDLE, run_import_progress_page_idle, pd, NULL);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]