Bug 18282 - dbus-c++ - GLIB integration - very broken, patch attached
Summary: dbus-c++ - GLIB integration - very broken, patch attached
Status: RESOLVED FIXED
Alias: None
Product: dbus
Classification: Unclassified
Component: GLib (show other bugs)
Version: unspecified
Hardware: x86-64 (AMD64) Linux (All)
: highest blocker
Assignee: shackan
QA Contact: John (J5) Palmieri
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-28 17:51 UTC by Cristi Posoiu
Modified: 2008-10-29 07:12 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
(git) patch for fixing the problem (8.87 KB, patch)
2008-10-28 17:51 UTC, Cristi Posoiu
Details | Splinter Review

Description Cristi Posoiu 2008-10-28 17:51:59 UTC
Created attachment 19921 [details] [review]
(git) patch for fixing the problem

dbux-c++, Glib integration (http://www.freedesktop.org/wiki/Software/dbus-c%2B%2B).

Having a client calling one method, through dbus, on a "server", which in turns emits some signals, which are captured by the client.
The problem is that I do not receive the signals into the program.
I did a strace (didn't know about dbus-monitor) and saw the packets (for the "signals") were actually getting to the client. After debugging and looking a bit also at dbus-glib (C version) I found the problem in the fact that the messages that were already queued for dispatching weren't actually dispatched (until I stopped and restarted the server for example :-( ). The call to dispatch_pending() in one of the watches had no effect since dbus knew it wasn't expecting neither reading or writing between the client and server, and so the watch(es) were actually disabled.

Btw, another person seems to have the same problem (althouh his C version of the program isn't actually the same since he was calling the method without waiting for replay): http://www.nabble.com/dbus-c%2B%2B:-strange-behavior-when-using-gtkmm-td19610503.html


Anyway, (git) patch attached.
What it fixes/does:
- removed comments around the IO_OUT when polling :-) (yes, they made CPU busy but because of another bug)
- fixed Timeout and Watch to not automatically call in constructor _enable, *unless* they were actually enabled (that allowed to put back the IO_OUT)
- add a few functions to Connection and Dispatcher to know if there are pending messages to be dispaatched
- added a GSource, named DispatcherSource that would do the dispatching of pending events
    - this allowed removal of the TODO: comment about code not working if there were several dispatchers
- a few sanity checks

Hope that helps,
  Cristi Posoiu

PS: Why not a specific section/module in bugzilla for dbus-c++ ?

====
OS: Ubuntu 8.04
dbus-c++ - latest version from GIT repo
libdbus - 1.3 (installed by ubuntu 8.04)
Comment 1 shackan 2008-10-29 07:12:52 UTC
thanks a lot, I've just pushed it but I've never used glib and that part was admittedly a quick hack, so feel free to reopen if anything is still missing

thanks again

PS: http://sourceforge.net/tracker2/?group_id=236997


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.