mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-23 10:42:11 +01:00
Merge branch 'backport-1665-win32-module-glib-2-64' into 'glib-2-64'
Backport !1665 “Fix g_module_symbol() under Windows sometimes not succeeding” to glib-2-64 See merge request GNOME/glib!1666
This commit is contained in:
commit
6711f7d2f4
@ -131,7 +131,20 @@ find_in_any_module_using_toolhelp (const gchar *symbol_name)
|
||||
/* Under UWP, Module32Next and Module32First are not available since we're
|
||||
* not allowed to search in the address space of arbitrary loaded DLLs */
|
||||
#if !defined(G_WINAPI_ONLY_APP)
|
||||
if ((snapshot = CreateToolhelp32Snapshot (TH32CS_SNAPMODULE, 0)) == (HANDLE) -1)
|
||||
/* https://docs.microsoft.com/en-us/windows/win32/api/tlhelp32/nf-tlhelp32-createtoolhelp32snapshot#remarks
|
||||
* If the function fails with ERROR_BAD_LENGTH, retry the function until it succeeds. */
|
||||
while (TRUE)
|
||||
{
|
||||
snapshot = CreateToolhelp32Snapshot (TH32CS_SNAPMODULE, 0);
|
||||
if (snapshot == INVALID_HANDLE_VALUE && GetLastError () == ERROR_BAD_LENGTH)
|
||||
{
|
||||
g_thread_yield ();
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (snapshot == INVALID_HANDLE_VALUE)
|
||||
return NULL;
|
||||
|
||||
me32.dwSize = sizeof (me32);
|
||||
|
Loading…
x
Reference in New Issue
Block a user