launcher: Make sure we drop drm master before we allow VT switches

On shutdown, we can risk having a pending vt switch that we normally
handle in the vt signal handler.  However as we put the vt back in VT_AUTO
mode, the pending VT switch will go through and if we haven't dropped
drm master at that point, we could switch to another display server
without dropping drm master.  That will typically crash the other server,
so let's try to make sure we don't do that.

https://bugs.freedesktop.org/show_bug.cgi?id=70877
This commit is contained in:
Kristian Høgsberg 2013-10-30 16:27:16 -07:00
parent aa2ee8bdf6
commit a28ba55b56
2 changed files with 10 additions and 0 deletions

View File

@ -202,6 +202,11 @@ weston_launcher_restore(struct weston_launcher *launcher)
if (ioctl(launcher->tty, KDSETMODE, KD_TEXT))
weston_log("failed to set KD_TEXT mode on tty: %m\n");
/* We have to drop master before we switch the VT back in
* VT_AUTO, so we don't risk switching to a VT with another
* display server, that will then fail to set drm master. */
drm_drop_master(launcher->drm_fd);
mode.mode = VT_AUTO;
if (ioctl(launcher->tty, VT_SETMODE, &mode) < 0)
weston_log("could not reset vt handling\n");

View File

@ -407,6 +407,11 @@ quit(struct weston_launch *wl, int status)
if (ioctl(wl->tty, KDSETMODE, KD_TEXT))
fprintf(stderr, "failed to set KD_TEXT mode on tty: %m\n");
/* We have to drop master before we switch the VT back in
* VT_AUTO, so we don't risk switching to a VT with another
* display server, that will then fail to set drm master. */
drmDropMaster(wl->drm_fd);
mode.mode = VT_AUTO;
if (ioctl(wl->tty, VT_SETMODE, &mode) < 0)
fprintf(stderr, "could not reset vt handling\n");