From 7f29172baf7a4ae57eb5af3e3ccd667553aa73f8 Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Mon, 20 Apr 2015 21:30:26 +0200 Subject: vo_drm: fix releasing VT if received signal twice If user switched terminals frantically, mpv could get SIGUSR1 twice in a row, which, up until now, resulted in destroying CRTC twice. This caused it to segfault. After this fix, double SIGUSR1 should be ignored. --- video/out/vo_drm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/video/out/vo_drm.c b/video/out/vo_drm.c index 3722f07db6..1c05b24008 100644 --- a/video/out/vo_drm.c +++ b/video/out/vo_drm.c @@ -350,6 +350,7 @@ static void modeset_page_flipped(int fd, unsigned int frame, unsigned int sec, static int setup_vo_crtc(struct vo *vo) { struct priv *p = vo->priv; + if (p->active) return; p->old_crtc = drmModeGetCrtc(p->fd, p->dev->crtc); int ret = drmModeSetCrtc(p->fd, p->dev->crtc, p->dev->bufs[p->dev->front_buf + BUF_COUNT - 1].fb, @@ -362,6 +363,7 @@ static void release_vo_crtc(struct vo *vo) { struct priv *p = vo->priv; + if (!p->active) return; p->active = false; // wait for current page flip @@ -383,6 +385,7 @@ static void release_vo_crtc(struct vo *vo) 1, &p->dev->mode); drmModeFreeCrtc(p->old_crtc); + p->old_crtc = NULL; } } -- cgit v1.2.3