gio/tests/testapps: Fix source refcounting
authorDan Winship <danw@gnome.org>
Tue, 22 Jun 2010 19:31:55 +0000 (15:31 -0400)
committerDan Winship <danw@gnome.org>
Tue, 22 Jun 2010 19:37:42 +0000 (15:37 -0400)
Either child_watch_source or timeout_source will already have been
destroyed after we finish the loop, and it's not safe to call
g_source_destroy() on it a second time unless we're still holding a
ref on it.

gio/tests/testapps.c

index 854d7fa7e023b422eac6051dec0de977c14c1b19..1def1705872e24cbd7ffa0c518a3600b52c8e9a1 100644 (file)
@@ -142,17 +142,17 @@ await_child_termination_run (AwaitChildTerminationData *data)
   child_watch_source = g_child_watch_source_new (data->pid);
   g_source_set_callback (child_watch_source, (GSourceFunc) on_child_termination_exited, data, NULL);
   g_source_attach (child_watch_source, data->context);
-  g_source_unref (child_watch_source);
 
   timeout_source = g_timeout_source_new_seconds (5);
   g_source_set_callback (timeout_source, on_child_termination_timeout, data, NULL);
   g_source_attach (timeout_source, data->context);
-  g_source_unref (timeout_source);
 
   g_main_loop_run (data->loop);
 
   g_source_destroy (child_watch_source);
+  g_source_unref (child_watch_source);
   g_source_destroy (timeout_source);
+  g_source_unref (timeout_source);
 
   g_main_loop_unref (data->loop);