summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>2018-07-14 12:58:59 -0300
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>2018-07-14 12:58:59 -0300
commit93b9bc789c361b59782efe264edb04ed1063750b (patch)
tree0ed09490eb62e891da2b682bae77c8eb2d1748c3
parent161d2540e659fa8ed5efc74f350a741b2430417d (diff)
downloadmutter-gbsneto/tty-switch-crash.tar.gz
gpu-kms: Protect against NULL crtc->current_modegbsneto/tty-switch-crash
When failing to apply the CRTC mode, Mutter throws a warning message. This warning message would try to access the name of the CRTC's current mode. There are ocasions, however, where the current mode is NULL. On these cases, Mutter would crash. Fix that by protecting against NULL CRTC modes.
-rw-r--r--src/backends/native/meta-gpu-kms.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/backends/native/meta-gpu-kms.c b/src/backends/native/meta-gpu-kms.c
index 0a3063576..c5af784db 100644
--- a/src/backends/native/meta-gpu-kms.c
+++ b/src/backends/native/meta-gpu-kms.c
@@ -148,7 +148,10 @@ meta_gpu_kms_apply_crtc_mode (MetaGpuKms *gpu_kms,
connectors, n_connectors,
mode) != 0)
{
- g_warning ("Failed to set CRTC mode %s: %m", crtc->current_mode->name);
+ if (crtc->current_mode)
+ g_warning ("Failed to set CRTC mode %s: %m", crtc->current_mode->name);
+ else
+ g_warning ("Failed to set CRTC mode: %m");
g_free (connectors);
return FALSE;
}