(5) fix foo_mem_clean() functions to avoid race cond.
[systembsd.git] / src / interfaces / timedated / timedated.c
index 3df5fc6e3e1fd956ef15894741f2896eb154680b..72d14f8c80e7b67c6f2476ba96b743f025cbe89b 100644 (file)
@@ -123,8 +123,14 @@ static void timedated_on_name_lost(GDBusConnection *conn,
  * this stops our GMainLoop safely before letting main() return */
 void timedated_mem_clean() {
 
-    g_ptr_array_foreach(timedated_freeable, (GFunc) g_free, NULL);
-       g_ptr_array_free(timedated_freeable, TRUE);
+    g_printf("exiting...\n");
+
+    if(dbus_interface_exported)
+        g_dbus_interface_skeleton_unexport(G_DBUS_INTERFACE_SKELETON(timedated_interf));
+
+     if(g_main_loop_is_running(timedated_loop))
+        g_main_loop_quit(timedated_loop);
+
 }
 
 int main() {