Mercurial > pidgin
comparison src/plugin.c @ 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 | 18e619ed4eaf |
| children | df49362e0378 |
comparison
equal
deleted
inserted
replaced
| 12698:e5f79b206d7e | 12699:2b53185e5d8f |
|---|---|
| 236 } | 236 } |
| 237 } | 237 } |
| 238 | 238 |
| 239 plugin = gaim_plugin_new(has_file_extension(filename, G_MODULE_SUFFIX), filename); | 239 plugin = gaim_plugin_new(has_file_extension(filename, G_MODULE_SUFFIX), filename); |
| 240 | 240 |
| 241 if (plugin->native_plugin) { | |
| 242 const char *error; | |
| 241 #ifdef _WIN32 | 243 #ifdef _WIN32 |
| 242 /* Suppress error popups for failing to load plugins */ | 244 /* Suppress error popups for failing to load plugins */ |
| 243 UINT old_error_mode = SetErrorMode(SEM_FAILCRITICALERRORS); | 245 UINT old_error_mode = SetErrorMode(SEM_FAILCRITICALERRORS); |
| 244 #endif | 246 #endif |
| 245 | 247 |
| 246 if (plugin->native_plugin) { | |
| 247 const char *error; | |
| 248 /* | 248 /* |
| 249 * We pass G_MODULE_BIND_LOCAL here to prevent symbols from | 249 * We pass G_MODULE_BIND_LOCAL here to prevent symbols from |
| 250 * plugins being added to the global name space. | 250 * plugins being added to the global name space. |
| 251 * | 251 * |
| 252 * G_MODULE_BIND_LOCAL was added in glib 2.3.3. | 252 * G_MODULE_BIND_LOCAL was added in glib 2.3.3. |
| 289 plugin->handle = g_module_open(filename, G_MODULE_BIND_LAZY); | 289 plugin->handle = g_module_open(filename, G_MODULE_BIND_LAZY); |
| 290 #endif | 290 #endif |
| 291 | 291 |
| 292 if (plugin->handle == NULL) | 292 if (plugin->handle == NULL) |
| 293 { | 293 { |
| 294 #ifdef _WIN32 | |
| 295 /* Restore the original error mode */ | |
| 296 SetErrorMode(old_error_mode); | |
| 297 #endif | |
| 294 gaim_plugin_destroy(plugin); | 298 gaim_plugin_destroy(plugin); |
| 295 return NULL; | 299 return NULL; |
| 296 } | 300 } |
| 297 else | 301 else |
| 298 { | 302 { |
| 317 if (error != NULL) | 321 if (error != NULL) |
| 318 gaim_debug_error("plugins", "Error closing module %s: %s\n", | 322 gaim_debug_error("plugins", "Error closing module %s: %s\n", |
| 319 plugin->path, error); | 323 plugin->path, error); |
| 320 plugin->handle = NULL; | 324 plugin->handle = NULL; |
| 321 | 325 |
| 326 #ifdef _WIN32 | |
| 327 /* Restore the original error mode */ | |
| 328 SetErrorMode(old_error_mode); | |
| 329 #endif | |
| 322 gaim_plugin_destroy(plugin); | 330 gaim_plugin_destroy(plugin); |
| 323 return NULL; | 331 return NULL; |
| 324 } | 332 } |
| 325 gaim_init_plugin = unpunned; | 333 gaim_init_plugin = unpunned; |
| 326 } | |
| 327 else { | |
| 328 loader = find_loader_for_plugin(plugin); | |
| 329 | |
| 330 if (loader == NULL) { | |
| 331 gaim_plugin_destroy(plugin); | |
| 332 return NULL; | |
| 333 } | |
| 334 | |
| 335 gaim_init_plugin = GAIM_PLUGIN_LOADER_INFO(loader)->probe; | |
| 336 } | |
| 337 | 334 |
| 338 #ifdef _WIN32 | 335 #ifdef _WIN32 |
| 339 /* Restore the original error mode */ | 336 /* Restore the original error mode */ |
| 340 SetErrorMode(old_error_mode); | 337 SetErrorMode(old_error_mode); |
| 341 #endif | 338 #endif |
| 339 } | |
| 340 else { | |
| 341 loader = find_loader_for_plugin(plugin); | |
| 342 | |
| 343 if (loader == NULL) { | |
| 344 gaim_plugin_destroy(plugin); | |
| 345 return NULL; | |
| 346 } | |
| 347 | |
| 348 gaim_init_plugin = GAIM_PLUGIN_LOADER_INFO(loader)->probe; | |
| 349 } | |
| 342 | 350 |
| 343 if (!gaim_init_plugin(plugin) || plugin->info == NULL) | 351 if (!gaim_init_plugin(plugin) || plugin->info == NULL) |
| 344 { | 352 { |
| 345 gaim_plugin_destroy(plugin); | 353 gaim_plugin_destroy(plugin); |
| 346 return NULL; | 354 return NULL; |
