[libgepub/wip/hadess-bug-fixes: 1/3] tests: Fix crash on exit
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgepub/wip/hadess-bug-fixes: 1/3] tests: Fix crash on exit
- Date: Mon, 15 Jan 2018 16:46:54 +0000 (UTC)
commit 55206d065797b9faddfae3e5dfd8451743613136
Author: Bastien Nocera <hadess hadess net>
Date: Mon Jan 15 17:09:30 2018 +0100
tests: Fix crash on exit
When the main window is destroyed, and the view widget is as well, we'd
receive a property change ("notify") signal for the parent widget of the
view changing. Except that we're in the middle of destroying that view.
Disconnect from the "notify" signal before exiting, so that we don't
crash on exit.
tests/test-gepub.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/tests/test-gepub.c b/tests/test-gepub.c
index 73e1666..1d6c0d8 100644
--- a/tests/test-gepub.c
+++ b/tests/test-gepub.c
@@ -273,6 +273,16 @@ test_doc_spine (const char *path)
g_object_unref (G_OBJECT (doc));
}
+static void
+destroy_cb (GtkWidget *window,
+ GtkWidget *view)
+{
+ g_signal_handlers_disconnect_by_func (G_OBJECT (view),
+ reload_current_chapter,
+ view);
+ gtk_main_quit ();
+}
+
int
main (int argc, char **argv)
{
@@ -321,7 +331,7 @@ main (int argc, char **argv)
}
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- g_signal_connect (window, "destroy", (GCallback)gtk_main_quit, NULL);
+ g_signal_connect (window, "destroy", G_CALLBACK(destroy_cb), widget);
gtk_widget_set_size_request (GTK_WIDGET (window), 1200, 800);
vpaned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
gtk_container_add (GTK_CONTAINER (window), vpaned);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]