aboutsummaryrefslogtreecommitdiffstats
path: root/src/interfaces/timedated/timedated.c
diff options
context:
space:
mode:
authorkremlin <ian@kremlin.cc>2014-08-05 10:50:37 +0800
committerkremlin <ian@kremlin.cc>2014-08-05 10:50:37 +0800
commit9728ae1fd2b7c7851673a27f698ae2e3c8c03461 (patch)
tree9cd180616a510fe7519de2b903b7cfc01a7e93bb /src/interfaces/timedated/timedated.c
parent2ef2cfe10db118edc44aaea13d4af130aef77083 (diff)
downloadsystembsd-9728ae1fd2b7c7851673a27f698ae2e3c8c03461.tar
systembsd-9728ae1fd2b7c7851673a27f698ae2e3c8c03461.tar.gz
systembsd-9728ae1fd2b7c7851673a27f698ae2e3c8c03461.tar.bz2
systembsd-9728ae1fd2b7c7851673a27f698ae2e3c8c03461.tar.lz
systembsd-9728ae1fd2b7c7851673a27f698ae2e3c8c03461.tar.xz
systembsd-9728ae1fd2b7c7851673a27f698ae2e3c8c03461.tar.zst
systembsd-9728ae1fd2b7c7851673a27f698ae2e3c8c03461.zip
(8) [final] modify main() to call correct clean sequence
main() now sets the signal handlers (via function from previous commit) before establishing the GMainLoop as well as invoke the proper clean()'s after unref'ing the loop. at this point all four interfaces are at the same place structurally. builds all cases.
Diffstat (limited to 'src/interfaces/timedated/timedated.c')
-rw-r--r--src/interfaces/timedated/timedated.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/interfaces/timedated/timedated.c b/src/interfaces/timedated/timedated.c
index 32f040a..a0d536d 100644
--- a/src/interfaces/timedated/timedated.c
+++ b/src/interfaces/timedated/timedated.c
@@ -152,6 +152,8 @@ void set_signal_handlers() {
int main() {
+ set_signal_handlers();
+
timedated_loop = g_main_loop_new(NULL, TRUE);
timedated_freeable = g_ptr_array_new();
@@ -165,11 +167,14 @@ int main() {
NULL);
g_main_loop_run(timedated_loop);
+ /* runs until single g_main_loop_quit() call is raised inside <interface>_mem_clean() */
g_main_loop_unref(timedated_loop);
+ /* guaranteed unownable */
g_bus_unown_name(bus_descriptor);
- timedated_mem_clean();
+ /* at this point no operations can occur with our data, it is safe to free it + its container */
+ g_ptr_array_free(timedated_freeable, TRUE);
return 0;
}