Introduce our own shutdown callback mechanism.
Instead of adding stuff to `_shutdown()`, we can now register a shutdown routine from the respective `init()` function of our modules. This also has the advantage, that we're sure they're called in reverse order from how the initialization happened. I didn't simply use `atexit()` because POSIX says that the number of possible callbacks is limited (min 32) and I was not sure whether we will maybe extend this number at one point. Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
This commit is contained in:
@@ -17,6 +17,9 @@
|
||||
#include "plugins/plugins.h"
|
||||
#include "ui/window_list.h"
|
||||
|
||||
|
||||
void prof_shutdown(void);
|
||||
|
||||
void
|
||||
console_shows_online_presence_when_set_online(void** state)
|
||||
{
|
||||
@@ -35,7 +38,7 @@ console_shows_online_presence_when_set_online(void** state)
|
||||
sv_ev_contact_online(barejid, resource, NULL, NULL);
|
||||
|
||||
roster_destroy();
|
||||
plugins_shutdown();
|
||||
prof_shutdown();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -56,7 +59,7 @@ console_shows_online_presence_when_set_all(void** state)
|
||||
sv_ev_contact_online(barejid, resource, NULL, NULL);
|
||||
|
||||
roster_destroy();
|
||||
plugins_shutdown();
|
||||
prof_shutdown();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -77,7 +80,7 @@ console_shows_dnd_presence_when_set_all(void** state)
|
||||
sv_ev_contact_online(barejid, resource, NULL, NULL);
|
||||
|
||||
roster_destroy();
|
||||
plugins_shutdown();
|
||||
prof_shutdown();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -103,7 +106,7 @@ handle_offline_removes_chat_session(void** state)
|
||||
|
||||
roster_destroy();
|
||||
chat_sessions_clear();
|
||||
plugins_shutdown();
|
||||
prof_shutdown();
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user