diff options
author | Milan Crha <mcrha@redhat.com> | 2009-10-13 22:24:10 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2009-10-13 22:24:10 +0800 |
commit | e06b88c4fda627599d7c1a33ddec0a35a4374e4f (patch) | |
tree | a862b4d3909923719ab03936ec60dfc00f185ba8 /plugins/external-editor | |
parent | dc2953040b0fb9576411d2f145e7e6ff11dd989a (diff) | |
download | gsoc2013-evolution-e06b88c4fda627599d7c1a33ddec0a35a4374e4f.tar.gz gsoc2013-evolution-e06b88c4fda627599d7c1a33ddec0a35a4374e4f.tar.zst gsoc2013-evolution-e06b88c4fda627599d7c1a33ddec0a35a4374e4f.zip |
Bug #594471 - Shouldn't call e_error_new/run with NULL 'parent'
Diffstat (limited to 'plugins/external-editor')
-rw-r--r-- | plugins/external-editor/external-editor.c | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/plugins/external-editor/external-editor.c b/plugins/external-editor/external-editor.c index 88858c0211..adc9678550 100644 --- a/plugins/external-editor/external-editor.c +++ b/plugins/external-editor/external-editor.c @@ -196,11 +196,23 @@ update_composer_text (GArray *array) return FALSE; } +struct run_error_dialog_data +{ + EMsgComposer *composer; + const gchar *text; +}; + /* needed because the new thread needs to call g_idle_add () */ static gboolean -run_error_dialog (gchar *text) +run_error_dialog (struct run_error_dialog_data *data) { - e_error_run (NULL, text, NULL); + g_return_val_if_fail (data != NULL, FALSE); + + e_error_run (GTK_WINDOW (data->composer), data->text, NULL); + enable_composer (data->composer); + + g_free (data); + return FALSE; } @@ -246,10 +258,15 @@ async_external_editor (EMsgComposer *composer) content = gtkhtml_editor_get_text_plain (GTKHTML_EDITOR (composer), &length); g_file_set_contents (filename, content, length, NULL); } else { + struct run_error_dialog_data *data = g_new0 (struct run_error_dialog_data, 1); + + data->composer = composer; + data->text = "org.gnome.evolution.plugins.external-editor:no-temp-file"; + g_warning ("Temporary file fd is null"); - g_idle_add ((GSourceFunc) run_error_dialog, - (gpointer)"org.gnome.evolution.plugins.external-editor:no-temp-file"); - g_idle_add ((GSourceFunc) enable_composer, composer); + + /* run_error_dialog also calls enable_composer */ + g_idle_add ((GSourceFunc) run_error_dialog, data); return; } @@ -289,10 +306,15 @@ async_external_editor (EMsgComposer *composer) editor_cmd_line = g_strconcat (editor_cmd, " ", filename, NULL); if (!g_spawn_command_line_sync (editor_cmd_line, NULL, NULL, &status, NULL)) { + struct run_error_dialog_data *data = g_new0 (struct run_error_dialog_data, 1); + g_warning ("Unable to launch %s: ", editor_cmd_line); - g_idle_add ((GSourceFunc) run_error_dialog, - (gpointer)"org.gnome.evolution.plugins.external-editor:editor-not-launchable"); - g_idle_add ((GSourceFunc) enable_composer, composer); + + data->composer = composer; + data->text = "org.gnome.evolution.plugins.external-editor:editor-not-launchable"; + + /* run_error_dialog also calls enable_composer */ + g_idle_add ((GSourceFunc) run_error_dialog, data); g_free (filename); g_free (editor_cmd_line); |