summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlfred E. Heggestad <alfred.heggestad@gmail.com>2016-12-08 20:17:13 +0100
committerAlfred E. Heggestad <alfred.heggestad@gmail.com>2016-12-08 20:17:13 +0100
commit8b37c9e56e5f199dbed312d3ba502f828476a385 (patch)
tree980eb4a7d9afc9823ab1f423885d6adb4f8293ca
parent74c3b036a89c22c26f62b6aa086a9a1562c318fb (diff)
gtk: make init/close a bit more robust
-rw-r--r--modules/gtk/gtk_mod.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/modules/gtk/gtk_mod.c b/modules/gtk/gtk_mod.c
index 840909b..63e30d0 100644
--- a/modules/gtk/gtk_mod.c
+++ b/modules/gtk/gtk_mod.c
@@ -989,8 +989,10 @@ static int module_init(void)
aufilt_register(&vumeter);
#ifdef USE_NOTIFICATIONS
err = message_init(message_handler, &mod_obj);
- if (err)
+ if (err) {
+ warning("gtk: message_init failed (%m)\n", err);
return err;
+ }
#endif
err = cmd_register(baresip_commands(), cmdv, ARRAY_SIZE(cmdv));
@@ -1015,8 +1017,9 @@ static int module_close(void)
gtk_main_quit();
gdk_threads_leave();
}
- pthread_join(mod_obj.thread, NULL);
- mem_deref(mod_obj.mq);
+ if (mod_obj.thread)
+ pthread_join(mod_obj.thread, NULL);
+ mod_obj.mq = mem_deref(mod_obj.mq);
aufilt_unregister(&vumeter);
message_close();