[glib/wip/gcleanup] gdbus-example-export: Fix behavior when using cleanup



commit 7b01e934025840b4bdaf9ad0f057ca5c34bbf226
Author: Stef Walter <stefw gnome org>
Date:   Sat Nov 9 20:22:30 2013 +0100

    gdbus-example-export: Fix behavior when using cleanup

 gio/tests/gdbus-example-export.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/gio/tests/gdbus-example-export.c b/gio/tests/gdbus-example-export.c
index 38de95b..85e2461 100644
--- a/gio/tests/gdbus-example-export.c
+++ b/gio/tests/gdbus-example-export.c
@@ -288,12 +288,14 @@ on_name_acquired (GDBusConnection *connection,
 {
 }
 
+static GMainLoop *loop;
+
 static void
 on_name_lost (GDBusConnection *connection,
               const gchar     *name,
               gpointer         user_data)
 {
-  exit (1);
+  g_main_loop_quit (user_data);
 }
 
 G_CLEANUP_DEFINE (test);
@@ -302,7 +304,6 @@ int
 main (int argc, char *argv[])
 {
   guint owner_id;
-  GMainLoop *loop;
   MyObject *myobj;
 
   /* We are lazy here - we don't want to manually provide
@@ -331,6 +332,7 @@ main (int argc, char *argv[])
   g_dbus_node_info_unref (introspection_data);
 
   g_object_unref (myobj);
+  g_main_loop_unref (loop);
 
   return 0;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]