After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 667345 - Connect to gnome-screensaver when needed instead of at startup
Connect to gnome-screensaver when needed instead of at startup
Status: RESOLVED FIXED
Product: gnome-settings-daemon
Classification: Core
Component: power
3.3.x
Other Linux
: Normal minor
: ---
Assigned To: Martin Pitt
gnome-settings-daemon-maint
Depends on:
Blocks:
 
 
Reported: 2012-01-05 10:09 UTC by Martin Pitt
Modified: 2012-03-09 11:22 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
power: Lazily connect to gnome-screensaver (3.41 KB, patch)
2012-01-05 11:15 UTC, Martin Pitt
committed Details | Review

Description Martin Pitt 2012-01-05 10:09:52 UTC
In current trunk and 3.2.x, the libpower plugin connects to gnome-screensaver's D-BUS interface right at startup, and then saves the GDBusProxy.

This causes gnome-screensaver to be dbus-activated very early during session startup, which unnecessarily slows down boot speed. Usually g-s gets started much later through an autostart .desktop file, which can be further delayed with e. g. X-GNOME-Autostart-Delay=20 to keep it out of the critical path during boot.

Also, the proxy object will be invalid if gnome-screensaver gets killed or restarted in between g-s-d startup and the time when the power plugin actually calls it in upower_notify_sleep_cb().

To fix both, it would be better to create the GDBusProxy object in upower_notify_sleep_cb() instead of gsd_power_manager_start().

If gnome-screensaver fails to start, it will just fail as well at the beginning, so in both cases the screen lock will just fail on sleep. In the normal case, g-s is already running through the autostart desktop file, so there is no additional delay for entering sleep mode.

I'll work on a patch for this now.
Comment 1 Martin Pitt 2012-01-05 10:25:59 UTC
Sorry, the proxy object actually remains valid when gnome-screensaver gets restarted or killed (then it gets re-spawned), so please ignore that part.
Comment 2 Martin Pitt 2012-01-05 11:15:53 UTC
Created attachment 204678 [details] [review]
power: Lazily connect to gnome-screensaver

This patch changes the logic to lazy initialization. I. e. it keeps the global manager->priv->screensaver_proxy, initializes it the first time the screen lock is invoked, and then keeps it around for future invocations.

If you prefer, I'm also happy to simplify the code/patch by removing manager->priv->screensaver_proxy and always creating the proxy in upower_notify_sleep_cb().

Thanks for considering!
Comment 3 Bastien Nocera 2012-03-09 11:22:15 UTC
Attachment 204678 [details] pushed as b531fdd - power: Lazily connect to gnome-screensaver