diff options
author | Pavel Roskin <plroskin@gmail.com> | 2018-03-08 15:58:42 +0100 |
---|---|---|
committer | Debarshi Ray <debarshir@gnome.org> | 2018-03-08 16:00:40 +0100 |
commit | cc967849f7653c697c33571a1a6a55e9ffd966ff (patch) | |
tree | 0c58efba53cf750922fd222f7ab8616996791de8 | |
parent | add3592809355d037a1ef7d9ad05547827eb3b79 (diff) | |
download | gtk+-cc967849f7653c697c33571a1a6a55e9ffd966ff.tar.gz |
x11: Avoid a division by zero
This is similar to f44baf51d9e8616a but for RandR 1.3 servers like
x11rdp and Windows Exceed which don't return a refresh rate. Avoid a
crash when that happens.
https://bugzilla.gnome.org/show_bug.cgi?id=775546
-rw-r--r-- | gdk/x11/gdkscreen-x11.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gdk/x11/gdkscreen-x11.c b/gdk/x11/gdkscreen-x11.c index 20fd27531e..272cecd7aa 100644 --- a/gdk/x11/gdkscreen-x11.c +++ b/gdk/x11/gdkscreen-x11.c @@ -658,7 +658,8 @@ init_randr13 (GdkScreen *screen, gboolean *changed) XRRModeInfo *xmode = &resources->modes[j]; if (xmode->id == crtc->mode) { - refresh_rate = (1000 * xmode->dotClock) / (xmode->hTotal *xmode->vTotal); + if (xmode->hTotal != 0 && xmode->vTotal != 0) + refresh_rate = (1000 * xmode->dotClock) / (xmode->hTotal * xmode->vTotal); break; } } |