Failing example program to send and receive dbus messages

Jonne Zutt j.zutt at
Wed May 2 06:29:51 PDT 2007

Attached is an example program that should be able to send and receive
dbus messages at the same time (using glib).
Our problem is that after receiving some messages, the first attempt to
send a message results in a segfault.

The stacktrace is not always the same, see the bottom of this email for
an example trace.

 - To compile:
	g++ -o connector -pthread `pkg-config --libs --cflags
 - Start first instance:
	./connector some.a some.b
 - Start second instance:
	./connector some.b some.a

Thanks in advance,

(gdb) r
Starting program: /tmp/connector some.b some.a
[Thread debugging using libthread_db enabled]
[New Thread -1208268576 (LWP 19340)]
me some.b, he some.a
[New Thread -1208271984 (LWP 19343)]
Dbus receive thread starts glib-mainloop.
Received: String-0
Received: String-1
Received: String-2
Received: String-3
Received: String-4
Received: String-5
Received: String-6
Received: String-7
Received: String-8
Received: String-9
Received: String-10
Received: String-11
Received: String-12
Received: String-13
Received: String-14
Received: String-15
Received: String-16
Received: String-17
Received: String-18
Received: String-19
Received: String-20
Sending: String-0

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1208268576 (LWP 19340)]
0x0032b3d6 in dbus_internal_do_not_use_get_uuid ()
from /lib/
(gdb) bt
#0  0x0032b3d6 in dbus_internal_do_not_use_get_uuid ()
from /lib/
#1  0x0032adfa in dbus_threads_init () from /lib/
#2  0x0032ae71 in dbus_threads_init () from /lib/
#3  0x00329029 in dbus_threads_init () from /lib/
#4  0x0032987e in dbus_threads_init () from /lib/
#5  0x003154f4 in dbus_connection_set_watch_functions ()
from /lib/
#6  0x003170cd in dbus_connection_open () from /lib/
#7  0x0031721c in dbus_connection_open () from /lib/
#8  0x003234d1 in dbus_pending_call_block () from /lib/
#9  0x00d449d8 in dbus_g_proxy_cancel_call ()
from /usr/lib/
#10 0x00d48a49 in dbus_g_proxy_call () from /usr/lib/
#11 0x08049545 in sendDBUS (msg=@0xbffda448) at
#12 0x0804998a in main (argc=3, argv=0xbffda4f4) at

-------------- next part --------------
A non-text attachment was scrubbed...
Type: text/x-c++src
Size: 4607 bytes
Desc: not available
Url :
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DbusConnection-glue.hh
Type: text/x-c++hdr
Size: 5254 bytes
Desc: not available
Url :

More information about the dbus mailing list