Patches by Kjartan Maraas <kmaraas at gnome dot org>
[platform/upstream/dbus.git] / dbus / dbus-dataslot.c
index 8026d04..83e2586 100644 (file)
@@ -21,7 +21,7 @@
  *
  */
 #include "dbus-dataslot.h"
-#include "dbus-threads.h"
+#include "dbus-threads-internal.h"
 
 /**
  * @defgroup DBusDataSlot Data slots
@@ -78,8 +78,11 @@ _dbus_data_slot_allocator_alloc (DBusDataSlotAllocator *allocator,
       _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)
     {
@@ -302,7 +305,7 @@ _dbus_data_slot_list_get  (DBusDataSlotAllocator *allocator,
    * are disabled, since then the asserts are empty.
    */
   if (!_dbus_mutex_lock (allocator->lock))
-    return FALSE;
+    return NULL;
   _dbus_assert (slot >= 0);
   _dbus_assert (slot < allocator->n_allocated_slots);
   _dbus_assert (allocator->allocated_slots[slot].slot_id == slot);