summaryrefslogtreecommitdiff
path: root/libgnomekbd
diff options
context:
space:
mode:
authorAntonio Ospite <ao2@ao2.it>2016-01-22 11:46:39 +0100
committerMichael Catanzaro <mcatanzaro@igalia.com>2016-01-22 09:59:31 -0600
commit1ae17df45b629441f5aa7ed946616b0a17e26dbf (patch)
treeb5496f1e808ab327e691dc8b2d1e54cbab257eca /libgnomekbd
parent32eaea94a3b19ad3c6b7fcff5fec94454fbfd97f (diff)
downloadlibgnomekbd-1ae17df45b629441f5aa7ed946616b0a17e26dbf.tar.gz
libgnomekbd/gkbd-keyboard-drawing.c: fix a segfault
When drawing the keyboard without having set the groups and levels there is a segmentation fault: Program received signal SIGSEGV, Segmentation fault. 0x00007fffe49ae8c9 in draw_key_label (is_pressed=<optimized out>, xkb_height=<optimized out>, xkb_width=<optimized out>, xkb_origin_y=<optimized out>, xkb_origin_x=<optimized out>, angle=0, keycode=<optimized out>, drawing=0xa540e0, context=0xca6080) at gkbd-keyboard-drawing.c:1017 1017 if (drawing->groupLevels[glp] == NULL) Fix that. The widget now is able to draw a keyboard without the keys labels, which can be useful when testing just the keyboard geometry. https://bugzilla.gnome.org/show_bug.cgi?id=760988
Diffstat (limited to 'libgnomekbd')
-rw-r--r--libgnomekbd/gkbd-keyboard-drawing.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libgnomekbd/gkbd-keyboard-drawing.c b/libgnomekbd/gkbd-keyboard-drawing.c
index cf32d57..9b8dae3 100644
--- a/libgnomekbd/gkbd-keyboard-drawing.c
+++ b/libgnomekbd/gkbd-keyboard-drawing.c
@@ -1000,7 +1000,7 @@ draw_key_label (GkbdKeyboardDrawingRenderContext * context,
gint padding;
gint g, l, glp;
- if (!drawing->xkb || keycode == INVALID_KEYCODE)
+ if (!drawing->xkb || !drawing->groupLevels || keycode == INVALID_KEYCODE)
return;
padding = 23 * context->scale_numerator / context->scale_denominator; /* 2.3mm */