gio/tests/testapps: Fix source refcounting

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.
This commit is contained in:
Dan Winship 2010-06-22 15:31:55 -04:00
parent a0e1b226a2
commit d68f8012b2

View 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);