dbus/dbus dbus-dataslot.c,1.10,1.11

John Palmieri johnp at kemper.freedesktop.org
Wed Aug 9 12:45:26 PDT 2006


Update of /cvs/dbus/dbus/dbus
In directory kemper:/tmp/cvs-serv22526/dbus

Modified Files:
	dbus-dataslot.c 
Log Message:
* Change an assert to a detailed warning and abort.  
  When allocator->lock != mutex it indicates that the user has failed
  to initalize threads before using the D-Bus library.  This warning
  helps the user identify the issue and fix their app.


Index: dbus-dataslot.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-dataslot.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- dbus-dataslot.c	25 Feb 2005 22:03:30 -0000	1.10
+++ dbus-dataslot.c	9 Aug 2006 19:45:24 -0000	1.11
@@ -78,8 +78,11 @@
       _dbus_assert (allocator->lock == NULL);
       allocator->lock = mutex;
     }
-  else
-    _dbus_assert (allocator->lock == mutex);
+  else if (allocator->lock != mutex)
+    {
+      _dbus_warn ("D-Bus threads were initialized after first using the D-Bus library. If your application does not directly initialize threads or use D-Bus, keep in mind that some library or plugin may have used D-Bus or initialized threads behind your back. You can often fix this problem by calling dbus_init_threads() or dbus_g_threads_init() early in your main() method, before D-Bus is used.");
+      _dbus_abort ();
+    }
 
   if (*slot_id_p >= 0)
     {



More information about the dbus-commit mailing list