From 948fd2b6f38595f42f03fdac840eff9feea7c8ff Mon Sep 17 00:00:00 2001 From: Packit Service Date: Dec 09 2020 22:19:01 +0000 Subject: Apply patch glib-prefer-constructors-over-DllMain.patch patch_name: glib-prefer-constructors-over-DllMain.patch present_in_specfile: true --- diff --git a/glib/glib-init.c b/glib/glib-init.c index 5f31211..427ad32 100644 --- a/glib/glib-init.c +++ b/glib/glib-init.c @@ -275,12 +275,14 @@ glib_init (void) #if defined (G_OS_WIN32) +HMODULE glib_dll = NULL; + +#if defined (DLL_EXPORT) + BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved); -HMODULE glib_dll; - BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, @@ -290,11 +292,6 @@ DllMain (HINSTANCE hinstDLL, { case DLL_PROCESS_ATTACH: glib_dll = hinstDLL; - g_clock_win32_init (); -#ifdef THREADS_WIN32 - g_thread_win32_init (); -#endif - glib_init (); break; case DLL_THREAD_DETACH: @@ -318,7 +315,10 @@ DllMain (HINSTANCE hinstDLL, return TRUE; } -#elif defined (G_HAS_CONSTRUCTORS) +#endif /* defined (DLL_EXPORT) */ +#endif /* defined (G_OS_WIN32) */ + +#if defined (G_HAS_CONSTRUCTORS) #ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA #pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(glib_init_ctor) @@ -328,6 +328,12 @@ G_DEFINE_CONSTRUCTOR(glib_init_ctor) static void glib_init_ctor (void) { +#if defined (G_OS_WIN32) + g_clock_win32_init (); +#ifdef THREADS_WIN32 + g_thread_win32_init (); +#endif /* defined (THREADS_WIN32) */ +#endif /* defined (G_OS_WIN32) */ glib_init (); }