[Xfce4-commits] <xfce4-xkb-plugin:4.10_panel_support> Check that current group number is sensible

Igor Slepchin noreply at xfce.org
Sat Jun 8 00:58:05 CEST 2013


Updating branch refs/heads/4.10_panel_support
         to 5efe92e830c77fbe97fea6c11e50827599b3f43a (commit)
       from c68e88ca7419a2010e0574f731555dc6652a8acf (commit)

commit 5efe92e830c77fbe97fea6c11e50827599b3f43a
Author: Igor Slepchin <igor.slepchin at gmail.com>
Date:   Fri Jun 7 17:33:32 2013 -0400

    Check that current group number is sensible
    
    xklavier seems to return an invalid group number occasionally;
    there isn't much we can do if xklavier "lies" to us but we can
    at least try not to crash. See bug 10128 and
    https://bugs.freedesktop.org/show_bug.cgi?id=65352.

 panel-plugin/xkb-config.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/panel-plugin/xkb-config.c b/panel-plugin/xkb-config.c
index 2871d96..27fe3ab 100644
--- a/panel-plugin/xkb-config.c
+++ b/panel-plugin/xkb-config.c
@@ -260,7 +260,12 @@ static gint
 xkb_config_get_current_group (void)
 {
     XklState* state = xkl_engine_get_current_state (config->engine);
-    return state->group;
+    g_assert(state->group >= 0 && state->group < config->group_count);
+
+    if (G_LIKELY (state->group >= 0 && state->group < config->group_count))
+        return state->group;
+    else
+        return 0;
 }
 
 gboolean


More information about the Xfce4-commits mailing list