[gtk+] Avoid a division by zero



commit f44baf51d9e8616acd9b929d9cfef83a4a3ad00a
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Jul 25 08:32:24 2016 -0400

    Avoid a division by zero
    
    It appears that xvfb returns nonsense in its xrandr resources.
    Avoid a crash when that happens.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=768999

 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 34dfccc..c189053 100644
--- a/gdk/x11/gdkscreen-x11.c
+++ b/gdk/x11/gdkscreen-x11.c
@@ -474,7 +474,8 @@ init_randr15 (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;
                 }
             }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]