dbus/glib dbus-gmain.c,1.24,1.25 dbus-gproxy.c,1.3,1.4

Havoc Pennington hp@pdx.freedesktop.org
Sat, 11 Oct 2003 22:59:41 -0700


Update of /cvs/dbus/dbus/glib
In directory pdx:/tmp/cvs-serv535/glib

Modified Files:
	dbus-gmain.c dbus-gproxy.c 
Log Message:
2003-10-12  Havoc Pennington  <hp@pobox.com>

        Added test code that 1) starts an actual bus daemon and 2) uses
	DBusGProxy; fixed bugs that were revealed by the test. Lots 
	more testing possible, but this is the basic framework.
	
	* glib/dbus-gproxy.c (dbus_gproxy_manager_unregister): remove
	empty proxy lists from the proxy list hash

	* dbus/dbus-message.c (dbus_message_iter_get_args_valist): add a
	couple of return_if_fail checks

	* dbus/dbus-pending-call.c (_dbus_pending_call_new): use dbus_new0
	to allocate, so everything is cleared to NULL as it should be.

	* glib/dbus-gmain.c (dbus_connection_setup_with_g_main): pass
	source as data to dbus_connection_set_timeout_functions() as the 
	timeout functions expected

	* test/glib/run-test.sh: add a little script to start up a message
	bus and run tests using it

	* tools/dbus-launch.1: updates

	* tools/dbus-launch.c (main): add --config-file option

	* tools/dbus-launch.c (main): remove confusing else if (runprog)
	that could never be reached.

	* dbus/dbus-message.c (dbus_message_new_method_return) 
	(dbus_message_new_error, dbus_message_new_signal): set the
	no-reply-expected flag on all these. Redundant, but may
	as well be consistent.



Index: dbus-gmain.c
===================================================================
RCS file: /cvs/dbus/dbus/glib/dbus-gmain.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- dbus-gmain.c	3 Oct 2003 03:55:35 -0000	1.24
+++ dbus-gmain.c	12 Oct 2003 05:59:39 -0000	1.25
@@ -492,7 +492,7 @@
                                               add_timeout,
                                               remove_timeout,
                                               timeout_toggled,
-                                              NULL, NULL))
+                                              source, NULL))
     goto nomem;
     
   dbus_connection_set_wakeup_main_function (connection,

Index: dbus-gproxy.c
===================================================================
RCS file: /cvs/dbus/dbus/glib/dbus-gproxy.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- dbus-gproxy.c	3 Oct 2003 03:55:35 -0000	1.3
+++ dbus-gproxy.c	12 Oct 2003 05:59:39 -0000	1.4
@@ -460,7 +460,7 @@
 #ifndef G_DISABLE_CHECKS
   if (manager->proxy_lists == NULL)
     {
-      g_warning ("Trying to disconnect a signal on a proxy but none are connected\n");
+      g_warning ("Trying to unregister a proxy but there aren't any registered");
       return;
     }
 #endif
@@ -468,13 +468,11 @@
   tri = tristring_from_proxy (proxy);
   
   list = g_hash_table_lookup (manager->proxy_lists, tri);
-  
-  g_free (tri);
 
 #ifndef G_DISABLE_CHECKS
   if (list == NULL)
     {
-      g_warning ("Trying to disconnect a signal on a proxy but none are connected\n");
+      g_warning ("Trying to unregister a proxy but it isn't registered");
       return;
     }
 #endif
@@ -485,12 +483,21 @@
 
   g_assert (g_slist_find (list->proxies, proxy) == NULL);
 
+  if (list->proxies == NULL)
+    {
+      g_hash_table_remove (manager->proxy_lists,
+                           tri);
+      list = NULL;
+    }
+  
   if (g_hash_table_size (manager->proxy_lists) == 0)
     {
       g_hash_table_destroy (manager->proxy_lists);
       manager->proxy_lists = NULL;
     }
-  
+
+  g_free (tri);
+      
   UNLOCK_MANAGER (manager);
 }