dbus/bus utils.h,1.6,1.7 dispatch.c,1.59,1.60

Olivier Andrieu oandrieu at freedesktop.org
Sat Jul 31 02:15:27 PDT 2004


Update of /cvs/dbus/dbus/bus
In directory pdx:/tmp/cvs-serv17410/bus

Modified Files:
	utils.h dispatch.c 
Log Message:
* dbus/dbus-internals.h (_DBUS_SET_OOM): 
* bus/utils.h (BUS_SET_OOM): use dbus_error_set_const instead of
dbus_error_set.

* bus/dispatch.c (check_send_exit_to_service): fix the test case,
broken by the change in the _SET_OOM macros.


Index: utils.h
===================================================================
RCS file: /cvs/dbus/dbus/bus/utils.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- utils.h	2 Dec 2003 10:44:21 -0000	1.6
+++ utils.h	31 Jul 2004 09:15:24 -0000	1.7
@@ -28,9 +28,9 @@
 #include <dbus/dbus.h>
 
 extern const char bus_no_memory_message[];
-#define BUS_SET_OOM(error) dbus_set_error ((error), DBUS_ERROR_NO_MEMORY, bus_no_memory_message)
+#define BUS_SET_OOM(error) dbus_set_error_const ((error), DBUS_ERROR_NO_MEMORY, bus_no_memory_message)
 
 void        bus_connection_dispatch_all_messages (DBusConnection *connection);
 dbus_bool_t bus_connection_dispatch_one_message  (DBusConnection *connection);
 
-#endif /* BUS_ACTIVATION_H */
+#endif /* BUS_UTILS_H */

Index: dispatch.c
===================================================================
RCS file: /cvs/dbus/dbus/bus/dispatch.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- dispatch.c	19 Jul 2004 20:55:58 -0000	1.59
+++ dispatch.c	31 Jul 2004 09:15:24 -0000	1.60
@@ -432,6 +432,16 @@
   return dbus_connection_pop_message (connection);
 }
 
+static DBusMessage*
+borrow_message_waiting_for_memory (DBusConnection *connection)
+{
+  while (dbus_connection_get_dispatch_status (connection) ==
+         DBUS_DISPATCH_NEED_MEMORY)
+    _dbus_wait_for_memory ();
+
+  return dbus_connection_borrow_message (connection);
+}
+
 static void
 warn_unexpected_real (DBusConnection *connection,
                       DBusMessage    *message,
@@ -1902,16 +1912,11 @@
                            const char     *activated_name,
                            const char     *base_service)
 {
-  DBusMessage *message;
   dbus_bool_t retval;
-  DBusError error;
   CheckServiceDeletedData csdd;
 
-  message = NULL;
   retval = FALSE;
   
-  dbus_error_init (&error);
-
   /* Now we are expecting ServiceDeleted messages for the base
    * service and the activated_name.  The base service
    * notification is required to come last.
@@ -1935,9 +1940,6 @@
   retval = TRUE;
   
  out:
-  if (message)
-    dbus_message_unref (message);
-  
   return retval;
 }
 
@@ -1995,7 +1997,7 @@
 
   /* see if we got an error during message bus dispatching */
   bus_test_run_clients_loop (FALSE);
-  message = dbus_connection_borrow_message (connection);
+  message = borrow_message_waiting_for_memory (connection);
   got_error = message != NULL && dbus_message_get_type (message) == DBUS_MESSAGE_TYPE_ERROR;
   if (message)
     {
@@ -2883,7 +2885,10 @@
   
   if (!_dbus_test_oom_handling (description, check_oom_check2_func,
                                 &d))
-    _dbus_assert_not_reached ("test failed");
+    {
+      _dbus_warn ("%s failed during oom\n", description);
+      _dbus_assert_not_reached ("test failed");
+    }
 }
 
 dbus_bool_t



More information about the dbus-commit mailing list