changeset 12623:70f18c73da9d

[gaim-migrate @ 14959] Prevent error popups from appearing when plugin DLLs can't be loaded by Windows LoadLibrary(). The messages still appear in the debug log. committer: Tailor Script <tailor@pidgin.im>
author Daniel Atallah <daniel.atallah@gmail.com>
date Thu, 22 Dec 2005 16:06:41 +0000
parents b7860c9902f2
children 851b0bd7eb52
files src/plugin.c
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugin.c	Thu Dec 22 14:58:45 2005 +0000
+++ b/src/plugin.c	Thu Dec 22 16:06:41 2005 +0000
@@ -226,6 +226,10 @@
 
 	if (plugin->native_plugin) {
 		const char *error;
+#ifdef _WIN32
+		/* Suppress error popups for failing to load plugins */
+		UINT old_error_mode = SetErrorMode(SEM_FAILCRITICALERRORS);
+#endif
 		/*
 		 * We pass G_MODULE_BIND_LOCAL here to prevent symbols from
 		 * plugins being added to the global name space.
@@ -239,6 +243,11 @@
 		plugin->handle = g_module_open(filename, 0);
 #endif
 
+#ifdef _WIN32
+		/* Restore the original error mode */
+		SetErrorMode(old_error_mode);
+#endif
+
 		if (plugin->handle == NULL)
 		{
 			error = g_module_error();