GNOME Bugzilla – Bug 600909
Shouldn't spy on org.gnome.ScreenSaver D-Bus messages
Last modified: 2009-11-08 17:37:17 UTC
I've been trying to debug a tricky session inhibit issue in Totem recently. Totem calls org.gnome.ScreenSaver.Inhibit when a video plays, but this always returns an error (Error org.freedesktop.DBus.Error.UnknownMethod: Method "Inhibit" with signature "ss" on interface "org.gnome.ScreenSaver" doesn't exist), despite the fact that the inhibit was registered correctly. Because a D-Bus error is returned instead of the inhibit cookie, it is not possible to uninhibit, and that inhibitor is then leaked for the rest of the session. I tried running gnome-screensaver in GDB, and noticed that the D-Bus call returned an error even with gnome-screensaver interrupted (so that it doesn't actually handle the call), which I thought was a bit strange. So, I started killing applications running in my session. When I kill hamster-applet, it all works correctly. To reproduce, run: dbus-send --session --dest='org.gnome.ScreenSaver' --print-reply --type=method_call /org/gnome/ScreenSaver org.gnome.ScreenSaver.Inhibit string:"foo" string:"Because I feel like it" Without hamster-applet running, it returns something like this: method return sender=:1.217 -> dest=:1.218 reply_serial=2 uint32 2104669466 I can now use the returned cookie to uninhibit :) But, with hamster-applet running, it returns this: Error org.freedesktop.DBus.Error.UnknownMethod: Method "Inhibit" with signature "ss" on interface "org.gnome.ScreenSaver" doesn't exist The inhibit was actually registered, but there is no cookie returned to let me uninhibit it. The code in hamster/idle.py seems weird. For example "Lock" is not a signal that gnome-screensaver emits when the screen is locked. It is a method for gnome-screensaver to tell it to lock. hamster-applet should not be listening to any org.gnome.ScreenSaver methods at all, but it currently listens to everything on the org.gnome.ScreenSaver interface, which seems wrong
*** Bug 599196 has been marked as a duplicate of this bug. ***
Thanks for the bug report and apologies for the trouble. Hamster is listening to screen saver because we need to differentiate between timeout and screen lock, and the lock method currently does not emit any signals. add_message_filter method of dbus has something peculiar about it - it is picky on the return value - introspection breaks if the filter returns null value, but your example breaks if it does not. I've pushed a fix to git master and gnome-2-28. Better solutions are always welcome.