Bug 28598

Summary: console-kit-daemon dumps core when login/logout via Sunray
Product: ConsoleKit Reporter: Halton Huo <halton.huo>
Component: DaemonAssignee: william.jon.mccann
Status: NEW --- QA Contact:
Severity: critical    
Priority: medium CC: brian.cameron
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Halton Huo 2010-06-18 02:47:58 UTC
This bug is copied from 
http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6951766.

Turns out this bug is introduced by commit b4f893eb294883909759fc9fd825eade1a9f308c, which is late than multi-seat branch created. So I'd like to file a separate bug to track it.

This happens when user logout, c-k-d trys to activate the reserved Login window session, and send out the two signals in change_active_session().
        g_signal_emit (seat, signals [ACTIVE_SESSION_CHANGED_FULL], 0, old_session, session);
        }
        g_signal_emit (seat, signals [ACTIVE_SESSION_CHANGED], 0, ssid);

The old_session is the session that user just log out, which should be removed after logout. I guess there is race condition here, if the old_session get unrefed to 0 before the g_signal_emit call, then core dump happens.

So the patch is like following:

diff --git a/src/ck-seat.c b/src/ck-seat.c
index dd2a387..72db11e 100644
--- a/src/ck-seat.c
+++ b/src/ck-seat.c
@@ -907,7 +907,10 @@ change_active_session (CkSeat    *seat,
          * must be sent when the database dump is finished it is
          * important that the '-full' signalled is emitted first. */
 
-        g_signal_emit (seat, signals [ACTIVE_SESSION_CHANGED_FULL], 0, old_sess
+        if (CK_IS_SESSION (old_session)) {
+                g_signal_emit (seat, signals [ACTIVE_SESSION_CHANGED_FULL], 0, 
+        }
+
         g_signal_emit (seat, signals [ACTIVE_SESSION_CHANGED], 0, ssid);
 
         if (old_session != NULL) {

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.