[gtk] widget: gdk_display_get_monitor can return NULL



commit d76a0feef697e6ad61333708b85625b102bb340a
Author: Timm Bäder <mail baedert org>
Date:   Tue Nov 20 12:44:23 2018 +0100

    widget: gdk_display_get_monitor can return NULL
    
    Fixes #1466

 gtk/gtkwidget.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 2b39f28f39..587bf81b0f 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -7617,7 +7617,10 @@ gtk_widget_get_scale_factor (GtkWidget *widget)
   display = _gtk_widget_get_display (widget);
   monitor = gdk_display_get_monitor (display, 0);
 
-  return gdk_monitor_get_scale_factor (monitor);
+  if (monitor)
+    return gdk_monitor_get_scale_factor (monitor);
+
+  return 1;
 }
 
 /**


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