diff options
author | kremlin <ian@kremlin.cc> | 2014-08-05 10:50:37 +0800 |
---|---|---|
committer | kremlin <ian@kremlin.cc> | 2014-08-05 10:50:37 +0800 |
commit | 7a088364959fdbe00831e81cfe542de5a4106fa5 (patch) | |
tree | 9cd180616a510fe7519de2b903b7cfc01a7e93bb /src/interfaces/logind/logind.c | |
parent | 34d88d96dc0e87a773bee8ea959d43074195af68 (diff) | |
download | systembsd-7a088364959fdbe00831e81cfe542de5a4106fa5.tar systembsd-7a088364959fdbe00831e81cfe542de5a4106fa5.tar.gz systembsd-7a088364959fdbe00831e81cfe542de5a4106fa5.tar.bz2 systembsd-7a088364959fdbe00831e81cfe542de5a4106fa5.tar.lz systembsd-7a088364959fdbe00831e81cfe542de5a4106fa5.tar.xz systembsd-7a088364959fdbe00831e81cfe542de5a4106fa5.tar.zst systembsd-7a088364959fdbe00831e81cfe542de5a4106fa5.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/logind/logind.c')
-rw-r--r-- | src/interfaces/logind/logind.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/interfaces/logind/logind.c b/src/interfaces/logind/logind.c index da9e24b..274bf16 100644 --- a/src/interfaces/logind/logind.c +++ b/src/interfaces/logind/logind.c @@ -152,6 +152,8 @@ void set_signal_handlers() { int main() { + set_signal_handlers(); + logind_loop = g_main_loop_new(NULL, TRUE); logind_freeable = g_ptr_array_new(); @@ -165,11 +167,15 @@ int main() { NULL); g_main_loop_run(logind_loop); + /* runs until single g_main_loop_quit() call is raised inside <interface>_mem_clean() */ g_main_loop_unref(logind_loop); + /* guaranteed unownable */ g_bus_unown_name(bus_descriptor); - logind_mem_clean(); + /* at this point no operations can occur with our data, it is safe to free it + its container */ + g_ptr_array_free(logind_freeable, TRUE); + return 0; } |