mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 11:26:16 +01:00
Merge branch 'fix-win32-g-module-symbol-flaky' into 'master'
Fix g_module_symbol() under Windows sometimes not succeeding Closes gtk#3213 See merge request GNOME/glib!1665
This commit is contained in:
commit
2d788652fd
@ -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…
Reference in New Issue
Block a user