about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2016-09-25 23:32:15 +0100
committerJames Booth <boothj5@gmail.com>2016-09-25 23:32:15 +0100
commitda437642a529612b70e1f1d16ff1a4f78bb3c441 (patch)
tree319975b29237268684723188b5fe09f02d581f61
parentb8bec9fce61455b71add1d920dd441bae3023bfa (diff)
parenta48df40138d0e7f3709a2ab45157f5696b6f861b (diff)
downloadprofani-tty-da437642a529612b70e1f1d16ff1a4f78bb3c441.tar.gz
Merge branch 'master' into win-order
-rw-r--r--src/plugins/plugins.c2
-rw-r--r--tests/unittests/test_server_events.c8
-rw-r--r--tests/unittests/unittests.c4
3 files changed, 13 insertions, 1 deletions
diff --git a/src/plugins/plugins.c b/src/plugins/plugins.c
index 97e328d7..a4846b20 100644
--- a/src/plugins/plugins.c
+++ b/src/plugins/plugins.c
@@ -839,4 +839,6 @@ plugins_shutdown(void)
     plugin_settings_close();
     callbacks_close();
     disco_close();
+    g_hash_table_destroy(plugins);
+    plugins = NULL;
 }
diff --git a/tests/unittests/test_server_events.c b/tests/unittests/test_server_events.c
index 9ab54cdb..fb178ac2 100644
--- a/tests/unittests/test_server_events.c
+++ b/tests/unittests/test_server_events.c
@@ -17,6 +17,7 @@
 void console_shows_online_presence_when_set_online(void **state)
 {
     prefs_set_string(PREF_STATUSES_CONSOLE, "online");
+    plugins_init();
     roster_create();
     char *barejid = "test1@server";
     roster_add(barejid, "bob", NULL, "both", FALSE);
@@ -29,11 +30,13 @@ void console_shows_online_presence_when_set_online(void **state)
     sv_ev_contact_online(barejid, resource, NULL, NULL);
 
     roster_destroy();
+    plugins_shutdown();
 }
 
 void console_shows_online_presence_when_set_all(void **state)
 {
     prefs_set_string(PREF_STATUSES_CONSOLE, "all");
+    plugins_init();
     roster_create();
     char *barejid = "test1@server";
     roster_add(barejid, "bob", NULL, "both", FALSE);
@@ -46,11 +49,13 @@ void console_shows_online_presence_when_set_all(void **state)
     sv_ev_contact_online(barejid, resource, NULL, NULL);
 
     roster_destroy();
+    plugins_shutdown();
 }
 
 void console_shows_dnd_presence_when_set_all(void **state)
 {
     prefs_set_string(PREF_STATUSES_CONSOLE, "all");
+    plugins_init();
     roster_create();
     char *barejid = "test1@server";
     roster_add(barejid, "bob", NULL, "both", FALSE);
@@ -63,10 +68,12 @@ void console_shows_dnd_presence_when_set_all(void **state)
     sv_ev_contact_online(barejid, resource, NULL, NULL);
 
     roster_destroy();
+    plugins_shutdown();
 }
 
 void handle_offline_removes_chat_session(void **state)
 {
+    plugins_init();
     roster_create();
     chat_sessions_init();
     char *barejid = "friend@server.chat.com";
@@ -85,6 +92,7 @@ void handle_offline_removes_chat_session(void **state)
 
     roster_destroy();
     chat_sessions_clear();
+    plugins_shutdown();
 }
 
 void lost_connection_clears_chat_sessions(void **state)
diff --git a/tests/unittests/unittests.c b/tests/unittests/unittests.c
index e427e151..e0a5dd34 100644
--- a/tests/unittests/unittests.c
+++ b/tests/unittests/unittests.c
@@ -429,7 +429,9 @@ int main(int argc, char* argv[]) {
         unit_test_setup_teardown(console_shows_dnd_presence_when_set_all,
             load_preferences,
             close_preferences),
-        unit_test(handle_offline_removes_chat_session),
+        unit_test_setup_teardown(handle_offline_removes_chat_session,
+            load_preferences,
+            close_preferences),
         unit_test(lost_connection_clears_chat_sessions),
 
         unit_test(cmd_alias_add_shows_usage_when_no_args),