diff options
author | Robert Tari <robert@tari.in> | 2021-01-24 19:58:36 +0100 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2021-01-27 17:10:55 +0100 |
commit | 1ff94facfad27f6db07b41b4e7d06c653a6a8fb0 (patch) | |
tree | c5f121345596c5952c9b324a82797f18b809cc54 /src/keyboard.c | |
parent | 7186ce77474fbc3fd6ed6aa679fcc12f2124de75 (diff) | |
download | ayatana-indicator-keyboard-1ff94facfad27f6db07b41b4e7d06c653a6a8fb0.tar.gz ayatana-indicator-keyboard-1ff94facfad27f6db07b41b4e7d06c653a6a8fb0.tar.bz2 ayatana-indicator-keyboard-1ff94facfad27f6db07b41b4e7d06c653a6a8fb0.zip |
Fix crash after Bluetooth pairing
Diffstat (limited to 'src/keyboard.c')
-rw-r--r-- | src/keyboard.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/keyboard.c b/src/keyboard.c index ad820096..e0f273f6 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -82,15 +82,28 @@ static gboolean onCheckSource(GSource *pSource) if (!xkl_config_rec_equals(pKeyboard->pPrivate->pConfigRec, pConfigRec)) { + gboolean bBadSignal = FALSE; + if (g_strv_length(pKeyboard->pPrivate->pConfigRec->layouts) > g_strv_length(pConfigRec->layouts)) { - xkl_engine_lock_group(pKeyboard->pPrivate->pEngine, 0); - pKeyboard->pPrivate->nLayout = 0; - bLayoutChanged = TRUE; + // Pairing a Bluetooth device does this sometimes + if (pConfigRec->variants[0] == NULL) + { + bBadSignal = TRUE; + } + else + { + xkl_engine_lock_group(pKeyboard->pPrivate->pEngine, 0); + pKeyboard->pPrivate->nLayout = 0; + bLayoutChanged = TRUE; + } } - xkl_config_rec_get_from_server(pKeyboard->pPrivate->pConfigRec, pKeyboard->pPrivate->pEngine); - bConfigChanged = TRUE; + if (!bBadSignal) + { + xkl_config_rec_get_from_server(pKeyboard->pPrivate->pConfigRec, pKeyboard->pPrivate->pEngine); + bConfigChanged = TRUE; + } } g_object_unref(pConfigRec); |