e-comp-wl: Don't crash from a missing keymap
authorChris Michael <cp.michael@samsung.com>
Tue, 30 Jun 2015 13:10:54 +0000 (09:10 -0400)
committerChris Michael <cp.michael@samsung.com>
Tue, 30 Jun 2015 13:10:54 +0000 (09:10 -0400)
This fixes T2531 where E would crash if the keymap could not be
fetched from xkb. Now if no keymap rules, model, or layout are passed
in we will default to a US keymap.

Signed-off-by: Chris Michael <cp.michael@samsung.com>
src/bin/e_comp_wl_input.c

index 2e5fdce..5726132 100644 (file)
@@ -541,8 +541,11 @@ e_comp_wl_input_keymap_set(const char *rules, const char *model, const char *lay
    /* assemble xkb_rule_names so we can fetch keymap */
    memset(&names, 0, sizeof(names));
    if (rules) names.rules = strdup(rules);
+   else names.rules = strdup("evdev");
    if (model) names.model = strdup(model);
+   else names.model = strdup("pc105");
    if (layout) names.layout = strdup(layout);
+   else names.layout = strdup("us");
 
    /* unreference any existing context */
    if (e_comp->wl_comp_data->xkb.context) xkb_context_unref(e_comp->wl_comp_data->xkb.context);
@@ -552,9 +555,11 @@ e_comp_wl_input_keymap_set(const char *rules, const char *model, const char *lay
 
    /* fetch new keymap based on names */
    keymap = xkb_map_new_from_names(e_comp->wl_comp_data->xkb.context, &names, 0);
-
-   /* update compositor keymap */
-   _e_comp_wl_input_keymap_update(keymap);
+   if (keymap)
+     {
+        /* update compositor keymap */
+        _e_comp_wl_input_keymap_update(keymap);
+     }
 
    /* cleanup */
    free((char *)names.rules);