|
|
4b6aa8 |
From 112707bca6fe720422248f74127cf301d0adb799 Mon Sep 17 00:00:00 2001
|
|
|
4b6aa8 |
From: Jakub Filak <jfilak@redhat.com>
|
|
|
4b6aa8 |
Date: Thu, 28 Aug 2014 12:22:39 +0200
|
|
|
4b6aa8 |
Subject: [LIBREPORT PATCH 54/93] wizard: don't work with destroyed widgets
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
Related to rhbz#1069917
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
Signed-off-by: Jakub Filak <jfilak@redhat.com>
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
Conflicts:
|
|
|
4b6aa8 |
src/gui-wizard-gtk/wizard.c
|
|
|
4b6aa8 |
---
|
|
|
4b6aa8 |
src/gui-wizard-gtk/wizard.c | 35 ++++++++++++++++++++++++++++-------
|
|
|
4b6aa8 |
1 file changed, 28 insertions(+), 7 deletions(-)
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
|
|
|
4b6aa8 |
index caae1d2..71964a9 100644
|
|
|
4b6aa8 |
--- a/src/gui-wizard-gtk/wizard.c
|
|
|
4b6aa8 |
+++ b/src/gui-wizard-gtk/wizard.c
|
|
|
4b6aa8 |
@@ -57,6 +57,7 @@ static char *g_event_selected;
|
|
|
4b6aa8 |
static unsigned g_black_event_count = 0;
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
static pid_t g_event_child_pid = 0;
|
|
|
4b6aa8 |
+static guint g_event_source_id = 0;
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
static bool g_expert_mode;
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
@@ -1586,10 +1587,18 @@ static void update_event_log_on_disk(const char *str)
|
|
|
4b6aa8 |
dd_close(dd);
|
|
|
4b6aa8 |
}
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
+static bool cancel_event_run()
|
|
|
4b6aa8 |
+{
|
|
|
4b6aa8 |
+ if (g_event_child_pid <= 0)
|
|
|
4b6aa8 |
+ return false;
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
+ kill(- g_event_child_pid, SIGTERM);
|
|
|
4b6aa8 |
+ return true;
|
|
|
4b6aa8 |
+}
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
static void on_btn_cancel_event(GtkButton *button)
|
|
|
4b6aa8 |
{
|
|
|
4b6aa8 |
- if (g_event_child_pid > 0)
|
|
|
4b6aa8 |
- kill(- g_event_child_pid, SIGTERM);
|
|
|
4b6aa8 |
+ cancel_event_run();
|
|
|
4b6aa8 |
}
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
static bool is_processing_finished()
|
|
|
4b6aa8 |
@@ -1987,8 +1996,10 @@ static gboolean consume_cmd_output(GIOChannel *source, GIOCondition condition, g
|
|
|
4b6aa8 |
: _("Processing finished, please proceed to the next step."));
|
|
|
4b6aa8 |
}
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
- /*g_source_remove(evd->event_source_id);*/
|
|
|
4b6aa8 |
+ g_source_remove(g_event_source_id);
|
|
|
4b6aa8 |
+ g_event_source_id = 0;
|
|
|
4b6aa8 |
close(evd->fd);
|
|
|
4b6aa8 |
+ g_io_channel_unref(evd->channel);
|
|
|
4b6aa8 |
free_run_event_state(evd->run_state);
|
|
|
4b6aa8 |
strbuf_free(evd->event_log);
|
|
|
4b6aa8 |
free(evd->event_name);
|
|
|
4b6aa8 |
@@ -2085,7 +2096,7 @@ static void start_event_run(const char *event_name)
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
ndelay_on(evd->fd);
|
|
|
4b6aa8 |
evd->channel = g_io_channel_unix_new(evd->fd);
|
|
|
4b6aa8 |
- /*evd->event_source_id = */ g_io_add_watch(evd->channel,
|
|
|
4b6aa8 |
+ g_event_source_id = g_io_add_watch(evd->channel,
|
|
|
4b6aa8 |
G_IO_IN | G_IO_ERR | G_IO_HUP, /* need HUP to detect EOF w/o any data */
|
|
|
4b6aa8 |
consume_cmd_output,
|
|
|
4b6aa8 |
evd
|
|
|
4b6aa8 |
@@ -3368,13 +3379,23 @@ static void init_pages(void)
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
static void assistant_quit_cb(void *obj, void *data)
|
|
|
4b6aa8 |
{
|
|
|
4b6aa8 |
+ /* Suppress execution of consume_cmd_output() */
|
|
|
4b6aa8 |
+ if (g_event_source_id != 0)
|
|
|
4b6aa8 |
+ {
|
|
|
4b6aa8 |
+ g_source_remove(g_event_source_id);
|
|
|
4b6aa8 |
+ g_event_source_id = 0;
|
|
|
4b6aa8 |
+ }
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
+ cancel_event_run();
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
if (g_loaded_texts)
|
|
|
4b6aa8 |
{
|
|
|
4b6aa8 |
g_hash_table_destroy(g_loaded_texts);
|
|
|
4b6aa8 |
g_loaded_texts = NULL;
|
|
|
4b6aa8 |
}
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
- gtk_widget_destroy(GTK_WIDGET(data));
|
|
|
4b6aa8 |
+ gtk_widget_destroy(GTK_WIDGET(g_wnd_assistant));
|
|
|
4b6aa8 |
+ g_wnd_assistant = (void *)0xdeadbeaf;
|
|
|
4b6aa8 |
}
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
static void on_btn_startcast(GtkWidget *btn, gpointer user_data)
|
|
|
4b6aa8 |
@@ -3526,13 +3547,13 @@ void create_assistant(GtkApplication *app, bool expert_mode)
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
create_details_treeview();
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
- g_signal_connect(g_btn_close, "clicked", G_CALLBACK(assistant_quit_cb), g_wnd_assistant);
|
|
|
4b6aa8 |
+ g_signal_connect(g_btn_close, "clicked", G_CALLBACK(assistant_quit_cb), NULL);
|
|
|
4b6aa8 |
g_signal_connect(g_btn_stop, "clicked", G_CALLBACK(on_btn_cancel_event), NULL);
|
|
|
4b6aa8 |
g_signal_connect(g_btn_onfail, "clicked", G_CALLBACK(on_btn_failed_cb), NULL);
|
|
|
4b6aa8 |
g_signal_connect(g_btn_repeat, "clicked", G_CALLBACK(on_btn_repeat_cb), NULL);
|
|
|
4b6aa8 |
g_signal_connect(g_btn_next, "clicked", G_CALLBACK(on_next_btn_cb), NULL);
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
- g_signal_connect(g_wnd_assistant, "destroy", G_CALLBACK(assistant_quit_cb), g_wnd_assistant);
|
|
|
4b6aa8 |
+ g_signal_connect(g_wnd_assistant, "destroy", G_CALLBACK(assistant_quit_cb), NULL);
|
|
|
4b6aa8 |
g_signal_connect(g_assistant, "switch-page", G_CALLBACK(on_page_prepare), NULL);
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
g_signal_connect(g_tb_approve_bt, "toggled", G_CALLBACK(on_bt_approve_toggle), NULL);
|
|
|
4b6aa8 |
--
|
|
|
4b6aa8 |
1.8.3.1
|
|
|
4b6aa8 |
|