~vanvugt/lightdm/fix-1192051

« back to all changes in this revision

Viewing changes to src/plymouth.c

  • Committer: Daniel van Vugt
  • Date: 2013-06-19 13:30:22 UTC
  • Revision ID: daniel.van.vugt@canonical.com-20130619133022-ib3i0x1nxks95llb
seat-unity: Wait for Plymouth to complete the "deactivate" command. Otherwise
we risk fighting for the VT device and Plymouth's error handling is not robust
enough to handle that, making it spin at 100% CPU and never deactivating.
(LP: #1192051)

Show diffs side-by-side

added added

removed removed

Lines of Context:
81
81
}
82
82
 
83
83
void
84
 
plymouth_deactivate (void)
 
84
plymouth_deactivate (gboolean wait)
85
85
{
 
86
    gint attempt = 1;
86
87
    is_active = FALSE;
87
 
    plymouth_run_command ("deactivate", NULL);
 
88
 
 
89
    /*
 
90
     * The "plymouth" command has no option like --wait-for-deactivation so
 
91
     * we have to wait in a loop.
 
92
     */
 
93
    do
 
94
    {
 
95
        g_debug("Deactivating Plymouth (attempt #%d)", attempt);
 
96
        attempt++;
 
97
        plymouth_run_command ("deactivate", NULL);
 
98
 
 
99
        if (!wait)
 
100
            return;
 
101
 
 
102
        sleep (1);
 
103
        have_checked_active_vt = FALSE;
 
104
    } while (plymouth_has_active_vt () && attempt <= 60);
 
105
 
 
106
    if (has_active_vt)
 
107
        g_debug("Failed to deactivate Plymouth.");
88
108
}
89
109
 
90
110
void