gdkkeys-win32: Fix crash when keyboard DLL failed to load

DLL loading failures should not happen under normal circumstances, but
we should at least try not to crash and and print better diagnostic
messages if they do happen.

See #4610
This commit is contained in:
Philip Zander
2022-01-09 11:05:28 +01:00
parent 404229ad75
commit 8b1c334c4a
2 changed files with 50 additions and 17 deletions

View File

@ -180,7 +180,8 @@ keystate_to_modbits (GdkWin32KeymapLayoutInfo *info,
BYTE result = 0;
int i;
g_return_val_if_fail (tables != NULL, 0);
if (tables == NULL)
return 0;
vk_to_bit = tables->pCharModifiers.ptr->pVkToBit.ptr;
@ -198,7 +199,8 @@ modbits_to_level (GdkWin32KeymapLayoutInfo *info,
PKBDTABLES tables = (PKBDTABLES) info->tables;
PMODIFIERS modifiers;
g_return_val_if_fail (tables != NULL, 0);
if (tables == NULL)
return 0;
modifiers = tables->pCharModifiers.ptr;
if (modbits > modifiers->wMaxModBits)
@ -268,7 +270,8 @@ vk_to_char_fuzzy (GdkWin32KeymapLayoutInfo *info,
if (is_dead)
*is_dead = FALSE;
g_return_val_if_fail (tables != NULL, WCH_NONE);
if (tables == NULL)
return WCH_NONE;
wch_tables = tables->pVkToWcharTable.ptr;