comparison src/plugin.c @ 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 0692d20d9d81
children 0bc110c7ab91
comparison
equal deleted inserted replaced
12622:b7860c9902f2 12623:70f18c73da9d
224 224
225 plugin = gaim_plugin_new(has_file_extension(filename, G_MODULE_SUFFIX), filename); 225 plugin = gaim_plugin_new(has_file_extension(filename, G_MODULE_SUFFIX), filename);
226 226
227 if (plugin->native_plugin) { 227 if (plugin->native_plugin) {
228 const char *error; 228 const char *error;
229 #ifdef _WIN32
230 /* Suppress error popups for failing to load plugins */
231 UINT old_error_mode = SetErrorMode(SEM_FAILCRITICALERRORS);
232 #endif
229 /* 233 /*
230 * We pass G_MODULE_BIND_LOCAL here to prevent symbols from 234 * We pass G_MODULE_BIND_LOCAL here to prevent symbols from
231 * plugins being added to the global name space. 235 * plugins being added to the global name space.
232 * 236 *
233 * G_MODULE_BIND_LOCAL was added in glib 2.3.3. 237 * G_MODULE_BIND_LOCAL was added in glib 2.3.3.
237 plugin->handle = g_module_open(filename, G_MODULE_BIND_LOCAL); 241 plugin->handle = g_module_open(filename, G_MODULE_BIND_LOCAL);
238 #else 242 #else
239 plugin->handle = g_module_open(filename, 0); 243 plugin->handle = g_module_open(filename, 0);
240 #endif 244 #endif
241 245
246 #ifdef _WIN32
247 /* Restore the original error mode */
248 SetErrorMode(old_error_mode);
249 #endif
250
242 if (plugin->handle == NULL) 251 if (plugin->handle == NULL)
243 { 252 {
244 error = g_module_error(); 253 error = g_module_error();
245 gaim_debug_error("plugins", "%s is unloadable: %s\n", 254 gaim_debug_error("plugins", "%s is unloadable: %s\n",
246 plugin->path, error ? error : "Unknown error."); 255 plugin->path, error ? error : "Unknown error.");