summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJasper St. Pierre <jstpierre@mecheye.net>2014-02-22 18:00:57 -0500
committerJasper St. Pierre <jstpierre@mecheye.net>2014-02-23 10:54:32 -0500
commit29addc499ca0f8dc5bf9cf6d18eaaa01a5c2b985 (patch)
treed7458e6ca4c963d20e2c480a5371f56cd0d675e4 /src
parentcaa98de58184fcfc2d83bb6cfb3406869039d31b (diff)
shell-global: Only set the scale factor if get_setting succeeded
If gdk_screen_get_setting fails, like if it's running without XSettings, then the GValue will have a value of 0. A lot of code tries to divide by the scale factor. This produces NaN, and combined with the fact that NaN is "leaky", we very quickly end up spinning out of control.
Diffstat (limited to 'src')
-rw-r--r--src/shell-global.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/shell-global.c b/src/shell-global.c
index 7e0ac8b5..59b5273d 100644
--- a/src/shell-global.c
+++ b/src/shell-global.c
@@ -756,8 +756,8 @@ update_scale_factor (GdkScreen *screen, gpointer data)
GValue value = G_VALUE_INIT;
g_value_init (&value, G_TYPE_INT);
- gdk_screen_get_setting (global->gdk_screen, "gdk-window-scaling-factor", &value);
- g_object_set (context, "scale-factor", g_value_get_int (&value), NULL);
+ if (gdk_screen_get_setting (global->gdk_screen, "gdk-window-scaling-factor", &value))
+ g_object_set (context, "scale-factor", g_value_get_int (&value), NULL);
}
/* This is an IBus workaround. The flow of events with IBus is that every time