changeset 12699:2b53185e5d8f

[gaim-migrate @ 15042] I think this is the correct handling of the error mode on Win32. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Tue, 03 Jan 2006 18:12:54 +0000
parents e5f79b206d7e
children cf0d9e207cdc
files src/plugin.c
diffstat 1 files changed, 15 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugin.c	Tue Jan 03 17:55:38 2006 +0000
+++ b/src/plugin.c	Tue Jan 03 18:12:54 2006 +0000
@@ -238,13 +238,13 @@
 
 	plugin = gaim_plugin_new(has_file_extension(filename, G_MODULE_SUFFIX), filename);
 
+	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
 
-	if (plugin->native_plugin) {
-		const char *error;
 		/*
 		 * We pass G_MODULE_BIND_LOCAL here to prevent symbols from
 		 * plugins being added to the global name space.
@@ -291,6 +291,10 @@
 
 			if (plugin->handle == NULL)
 			{
+#ifdef _WIN32
+				/* Restore the original error mode */
+				SetErrorMode(old_error_mode);
+#endif
 				gaim_plugin_destroy(plugin);
 				return NULL;
 			}
@@ -319,10 +323,19 @@
 								 plugin->path, error);
 			plugin->handle = NULL;
 
+#ifdef _WIN32
+			/* Restore the original error mode */
+			SetErrorMode(old_error_mode);
+#endif
 			gaim_plugin_destroy(plugin);
 			return NULL;
 		}
 		gaim_init_plugin = unpunned;
+
+#ifdef _WIN32
+		/* Restore the original error mode */
+		SetErrorMode(old_error_mode);
+#endif
 	}
 	else {
 		loader = find_loader_for_plugin(plugin);
@@ -335,11 +348,6 @@
 		gaim_init_plugin = GAIM_PLUGIN_LOADER_INFO(loader)->probe;
 	}
 
-#ifdef _WIN32
-		/* Restore the original error mode */
-		SetErrorMode(old_error_mode);
-#endif
-
 	if (!gaim_init_plugin(plugin) || plugin->info == NULL)
 	{
 		gaim_plugin_destroy(plugin);