[gtk/gtk-3-24: 2/8] GdkWin32Keymap: Be more robust against DLL loading failures




commit aa3e6bb0a3ed1ba4c7782e07e9fe023922f14a87
Author: Philip Zander <philip zander gmail com>
Date:   Wed Jul 29 00:12:03 2020 +0200

    GdkWin32Keymap: Be more robust against DLL loading failures
    
    Fixes failure on the CI servers when generating GIR files

 gdk/win32/gdkkeys-win32-impl.c |  2 +-
 gdk/win32/gdkkeys-win32.c      | 14 +++++++++-----
 2 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/gdk/win32/gdkkeys-win32-impl.c b/gdk/win32/gdkkeys-win32-impl.c
index 239045193e..ec6861c7b8 100644
--- a/gdk/win32/gdkkeys-win32-impl.c
+++ b/gdk/win32/gdkkeys-win32-impl.c
@@ -18,7 +18,7 @@
  * I.e. 32 bits on 32-bit Windows and 64 bits on 64-bit Windows.
  *
  * This is *not* the same as the the bitness of the application, since it is
- * possible to execute 32-bit binaries on either a 32-bit or a 64-bit host.
+ * possible to execute 32-bit binaries on either a 32-bit *or* a 64-bit host.
  * On a 64-bit host, KBD_LONG_PTR will be 64-bits, even if the application 
  * itself is 32-bit. (Whereas on a 32-bit host, it will be 32-bit.)
  *
diff --git a/gdk/win32/gdkkeys-win32.c b/gdk/win32/gdkkeys-win32.c
index 50e6e3893d..f028e05460 100644
--- a/gdk/win32/gdkkeys-win32.c
+++ b/gdk/win32/gdkkeys-win32.c
@@ -595,17 +595,21 @@ update_keymap (GdkWin32Keymap *keymap)
 
           info->file = get_keyboard_layout_file (info->name);
 
-          info->key_entries = g_array_new (FALSE, FALSE, sizeof (KeyEntry));
+          if (load_layout_dll (keymap, info->file, info))
+            {
+              info->key_entries = g_array_new (FALSE, FALSE,
                                                sizeof (GdkWin32KeymapKeyEntry));
 
-          info->reverse_lookup_table = g_hash_table_new (g_direct_hash,
-                                                         g_direct_equal);
-          load_layout_dll (info->file, info);
-          init_vk_lookup_table (info);
+              info->reverse_lookup_table = g_hash_table_new (g_direct_hash,
+                                                             g_direct_equal);
+              init_vk_lookup_table (keymap, info);
+            }
         }
+
       if (info->handle == current_layout)
         keymap->active_layout = i;
     }
+
   if (changed)
     ActivateKeyboardLayout (current_layout, 0);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]