dbus-c++: strange behavior when using gtkmm
Jesús Ruiz de Infante
jesus.ruizdeinfante at hale.at
Mon Sep 22 08:32:58 PDT 2008
[I started this thread on dbus-cplusplus-devel at lists.sourceforge.net but got no response,
sorry for the crossposting. Hope it's OK]
It seems that in dbus-c++ there is a problem when the glib main loop must attend a dbus
signal coming just after it called a dbus method. If that dbus signal handler tries to
emit a sigc signal, the sigc signal is actually never emitted (or at least, a slot
connected to it is never executed).
I have prepared the following scenario:
Actors:
- testserver: A server of a simple service, with a signal (_signal_mode_switched)
and a method (handle_key_pressed_event). The handle_key_pressed_event() method
just emits _signal_mode_switched.
- testclient 1 & testclient 2 : two identical clients of the service. These are gtk
applications, where clicking in a button triggers a call to
handle_key_pressed_event(), and receiving a _signal_mode_switched, triggers a sigc
signal_mode_switched, which just changes a label in the application.
test svc server
.------------------------------------.
| .-------------------------------. |
| | handle_key_pressed_event | |
.------->| dbus: _signal_mode_switched | |
| | | | |
| | '-------------------------------' |
| | | |
| '------------------|-----------------'
| |
| |
.----------------------------. | .----------------------------.
| sigc: signal_mode_switched |<----------------->| sigc: signal_mode_switched |
| | | |
| .-------------------.| | .-------------------. |
| | || | | | |
| | on_mode_switched: || | | on_mode_switched: | |
| | change label || | | change label | |
| '-------------------'| | '-------------------' |
| | | |
'----------------------------' '----------------------------'
test svc client 1 test svc client 2
Assuming the following events:
- The user clicks on the single button of the first client, the client 1
calls the handle_key_pressed_event dbus method of the server.
- Then the server emits the dbus _signal_mode_switched, which is
received by both clients.
- On the clients, the _signal_mode_switched signal emits the sigc
signal_mode_switched.
- on_mode_switched, which is connected to signal_mode_switched,
should change the label on both clients.
The problem is, on_mode_switch is only called on the client that didn't
sent signal_mode_switched.
The result is the same independently of the number of clients.
All work as supposed except the one calling handle_key_pressed_event()
on the server.
I have attached some sample code.
System Info:
Centos 5.2
dbus-python-0.70-7.el5
dbus-1.0.0-7.el5
dbus-glib-0.70-5
dbus-glib-devel-0.70-5
dbus-devel-1.0.0-7.el5
dbus-x11-1.0.0-7.el5
pygtk2-2.10.1-12.el5
gtk2-engines-2.8.0-3.el5
pygtk2-libglade-2.10.1-12.el5
libgtk-java-2.8.7-3.el5
gtkspell-2.0.11-2.1
gtksourceview-1.8.0-1.fc6
gtk2-2.10.4-20.el5
gtk2-devel-2.10.4-20.el5
gtkhtml3-3.16.3-1.el5
gtk-doc-1.7-1.fc6
gtkhtml2-2.11.0-3
gtkmm24-2.10.10-1.el5
pygtk2-codegen-2.10.1-12.el5
usermode-gtk-1.88-3.el5.1
authconfig-gtk-5.3.21-3.el5
gtkmm24-devel-2.10.10-1.el5
gnome-python2-gtksourceview-2.16.0-2.el5
pygtk2-devel-2.10.1-12.el5
latest dbus-c++ from git repo
--
Mit freundlichen Grüßen
Jesus Ruiz de Infante
(Entwicklung)
HALE electronic GmbH
Eugen-Müller-Straße 18, 5020 Salzburg, Austria
Tel: +43 (662) 439011 0
Fax: +43 (662) 439011 9
jesus.ruizdeinfante at hale.at
Firmenbuchnummer: FN 66801m HG Salzburg
--
Scanned by MailScanner.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testgtkclient.cpp
Type: text/x-c++src
Size: 2337 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/dbus/attachments/20080922/70e2b92a/attachment.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testserver.cpp
Type: text/x-c++src
Size: 1406 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/dbus/attachments/20080922/70e2b92a/attachment-0001.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_svc_introspect.xml
Type: text/xml
Size: 458 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/dbus/attachments/20080922/70e2b92a/attachment.bin
More information about the dbus
mailing list