Mercurial > pidgin.yaz
changeset 2125:af59d854de29
[gaim-migrate @ 2135]
bmiller's patch to unload plugins on exit signals
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Mon, 06 Aug 2001 18:12:36 +0000 |
parents | a1922ad52304 |
children | b935eca131be |
files | src/aim.c src/buddy.c src/gaim.h src/plugins.c |
diffstat | 4 files changed, 21 insertions(+), 31 deletions(-) [+] |
line wrap: on
line diff
--- a/src/aim.c Mon Aug 06 17:54:50 2001 +0000 +++ b/src/aim.c Mon Aug 06 18:12:36 2001 +0000 @@ -87,24 +87,11 @@ gtk_widget_hide(mainwindow); #else #ifdef GAIM_PLUGINS - GList *c; - struct gaim_plugin *p; - void (*gaim_plugin_remove)(); - /* first we tell those who have requested it we're quitting */ plugin_event(event_quit, 0, 0, 0, 0); /* then we remove everyone in a mass suicide */ - c = plugins; - while (c) { - p = (struct gaim_plugin *)c->data; - if (g_module_symbol(p->handle, "gaim_plugin_remove", (gpointer *)&gaim_plugin_remove)) - (*gaim_plugin_remove)(); - /* we don't need to worry about removing callbacks since - * there won't be any more chance to call them back :) */ - g_free(p); - c = c->next; - } + remove_all_plugins(); #endif /* GAIM_PLUGINS */ #ifdef USE_PERL perl_end(); @@ -406,8 +393,9 @@ abort(); break; default: + debug_printf("caught signal %d\n", sig); gtkspell_stop(); - debug_printf("caught signal %d\n", sig); + remove_all_plugins(); if (gtk_main_level()) gtk_main_quit(); exit(0);
--- a/src/buddy.c Mon Aug 06 17:54:50 2001 +0000 +++ b/src/buddy.c Mon Aug 06 18:12:36 2001 +0000 @@ -1369,12 +1369,6 @@ void do_quit() { -#ifdef GAIM_PLUGINS - GList *c; - struct gaim_plugin *p; - void (*gaim_plugin_remove)(); -#endif - #ifdef USE_APPLET applet = NULL; #endif @@ -1384,16 +1378,7 @@ plugin_event(event_quit, 0, 0, 0, 0); /* then we remove everyone in a mass suicide */ - c = plugins; - while (c) { - p = (struct gaim_plugin *)c->data; - if (g_module_symbol(p->handle, "gaim_plugin_remove", (gpointer *)&gaim_plugin_remove)) - (*gaim_plugin_remove)(); - /* we don't need to worry about removing callbacks since - * there won't be any more chance to call them back :) */ - g_free(p); - c = c->next; - } + remove_all_plugins(); #endif system_log(log_quit, NULL, NULL, OPT_LOG_BUDDY_SIGNON | OPT_LOG_MY_SIGNON); #ifdef USE_PERL
--- a/src/gaim.h Mon Aug 06 17:54:50 2001 +0000 +++ b/src/gaim.h Mon Aug 06 18:12:36 2001 +0000 @@ -806,6 +806,7 @@ #endif extern char *event_name(enum gaim_event); extern int plugin_event(enum gaim_event, void *, void *, void *, void *); +extern void remove_all_plugins(); /* Functions in prefs.c */ extern void debug_printf( char * fmt, ... );
--- a/src/plugins.c Mon Aug 06 17:54:50 2001 +0000 +++ b/src/plugins.c Mon Aug 06 18:12:36 2001 +0000 @@ -981,3 +981,19 @@ return 0; #endif } + +/* Calls the gaim_plugin_remove function in any loaded plugin that has one */ +void remove_all_plugins() +{ + GList *c = plugins; + struct gaim_plugin *p; + void (*gaim_plugin_remove)(); + + while (c) { + p = (struct gaim_plugin *)c->data; + if (g_module_symbol(p->handle, "gaim_plugin_remove", (gpointer *)&gaim_plugin_remove)) + (*gaim_plugin_remove)(); + g_free(p); + c = c->next; + } +}