[glib] GModule win32: disable error dialog popup
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] GModule win32: disable error dialog popup
- Date: Thu, 2 Nov 2017 15:34:29 +0000 (UTC)
commit 719edde63b1f4756c61c325e8457c7d033be8194
Author: Tom Schoonjans <Tom Schoonjans diamond ac uk>
Date: Mon Jan 16 11:39:49 2017 +0530
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
gmodule/gmodule-win32.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/gmodule/gmodule-win32.c b/gmodule/gmodule-win32.c
index 4f707b5..20459f3 100644
--- a/gmodule/gmodule-win32.c
+++ b/gmodule/gmodule-win32.c
@@ -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)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]