mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-03 14:42:10 +01:00
GModule win32: disable error dialog popup
When loading a module on win32, a blocking error dialog pops up whenever the module could not be loaded. This is particularly annoying when module loading failure is a harmless and expected event... This patch temporarily disables these error dialogs from popping up. https://bugzilla.gnome.org/show_bug.cgi?id=777308
This commit is contained in:
parent
54f6c56235
commit
719edde63b
@ -70,6 +70,8 @@ _g_module_open (const gchar *file_name,
|
||||
{
|
||||
HINSTANCE handle;
|
||||
wchar_t *wfilename;
|
||||
DWORD old_mode;
|
||||
BOOL success;
|
||||
#ifdef G_WITH_CYGWIN
|
||||
gchar tmp[MAX_PATH];
|
||||
|
||||
@ -78,7 +80,13 @@ _g_module_open (const gchar *file_name,
|
||||
#endif
|
||||
wfilename = g_utf8_to_utf16 (file_name, -1, NULL, NULL, NULL);
|
||||
|
||||
/* suppress error dialog */
|
||||
success = SetThreadErrorMode (SEM_NOOPENFILEERRORBOX | SEM_FAILCRITICALERRORS, &old_mode);
|
||||
if (!success)
|
||||
set_error ("");
|
||||
handle = LoadLibraryW (wfilename);
|
||||
if (success)
|
||||
SetThreadErrorMode (old_mode, NULL);
|
||||
g_free (wfilename);
|
||||
|
||||
if (!handle)
|
||||
|
Loading…
x
Reference in New Issue
Block a user