Mercurial > pidgin
diff src/plugins.c @ 176:c99d0b82c8a8
[gaim-migrate @ 186]
Fixed a bug where if you unload a plugin that had 3 callbacks, it would only
unload 2 of them. Other touch-ups and additions.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Tue, 25 Apr 2000 18:55:56 +0000 |
parents | 1c4e47c0c5dd |
children | b402a23f35df |
line wrap: on
line diff
--- a/src/plugins.c Tue Apr 25 17:38:35 2000 +0000 +++ b/src/plugins.c Tue Apr 25 18:55:56 2000 +0000 @@ -147,6 +147,8 @@ sprintf(plug->filename, "%s%s", buf, filename); } else plug->filename = g_strdup(filename); + sprintf(debug_buff, "Loading %s\n", filename); + debug_print(debug_buff); /* do NOT OR with RTLD_GLOBAL, otherwise plugins may conflict * (it's really just a way to work around other people's bad * programming, by not using RTLD_GLOBAL :P ) */ @@ -343,22 +345,31 @@ if (i == NULL) return; p = gtk_object_get_user_data(GTK_OBJECT(i->data)); + sprintf(debug_buff, "Unloading %s\n", p->filename); + debug_print(debug_buff); gaim_plugin_remove = dlsym(p->handle, "gaim_plugin_remove"); if ((error = (char *)dlerror()) == NULL) (*gaim_plugin_remove)(); + sprintf(debug_buff, "%d callbacks to search\n", g_list_length(callbacks)); + debug_print(debug_buff); while (c) { g = (struct gaim_callback *)c->data; if (g->handle == p->handle) { callbacks = g_list_remove(callbacks, c->data); g_free(g); + sprintf(debug_buff, "Removing callback, %d remain\n", + g_list_length(callbacks)); + debug_print(debug_buff); c = callbacks; - if (c == NULL) break; + if (c == NULL) { + break; + } + } else { + c = c->next; } - c = c->next; } - /* don't ask me why this works */ - if (callbacks != NULL) dlclose(p->handle); + dlclose(p->handle); plugins = g_list_remove(plugins, p); g_free(p->filename); @@ -406,6 +417,8 @@ call->data = data; callbacks = g_list_append(callbacks, call); + sprintf(debug_buff, "Adding callback %d\n", g_list_length(callbacks)); + debug_print(debug_buff); } void gaim_signal_disconnect(void *handle, enum gaim_event which, void *func) {