# HG changeset patch # User Nathan Walp # Date 1050622967 0 # Node ID ab2ae9dc93705531ed9d209578d5f34be0813727 # Parent 9a19c0a1e1be7a03391833fe9cbb0b5ae7f22a4b [gaim-migrate @ 5515] This fixes a crash using zephyr + any other account, and a crash keeping convo windows open after an account has disconnected, and a few other crashes, and a crash in some code Chip hasn't written yet ;-) committer: Tailor Script diff -r 9a19c0a1e1be -r ab2ae9dc9370 src/buddy.c --- a/src/buddy.c Thu Apr 17 23:40:37 2003 +0000 +++ b/src/buddy.c Thu Apr 17 23:42:47 2003 +0000 @@ -1782,7 +1782,20 @@ struct prpl *prpl = find_prpl(account->protocol); GdkPixbuf *status = NULL; char *filename = NULL; - const char *protoname = prpl->list_icon(account, NULL); + const char *protoname = NULL; + + /* this is so we can get the icon when the prpl isn't loaded. + * it's not as bad as it looks, since most of the time this function + * is called, the prpl is already loaded, so it'll just increment and + * decrement the refcount, won't have to go through the hassle of + * actually loading and unloading the prpl. the few times it actually + * does that, it saves us from crashing */ + if(prpl && prpl->list_icon) { + ref_protocol(prpl); + protoname = prpl->list_icon(account, NULL); + unref_protocol(prpl); + } + /* "Hey, what's all this crap?" you ask. Status icons will be themeable too, and then it will look up protoname from the theme */ if (!strcmp(protoname, "aim")) { diff -r 9a19c0a1e1be -r ab2ae9dc9370 src/prpl.c --- a/src/prpl.c Thu Apr 17 23:40:37 2003 +0000 +++ b/src/prpl.c Thu Apr 17 23:42:47 2003 +0000 @@ -853,7 +853,7 @@ #ifdef GAIM_PLUGINS if(p->plug) { /* This protocol is a plugin */ prpl_accounts[p->protocol]++; - debug_printf("Protocol %s now in use by %d connections.\n", p->name, prpl_accounts[p->protocol]); + debug_printf("Protocol %s refcount now %d\n", p->name, prpl_accounts[p->protocol]); if(!p->plug->handle) { /*But the protocol isn't yet loaded */ unload_protocol(p); if (load_prpl(p)) @@ -868,7 +868,7 @@ #ifdef GAIM_PLUGINS if(p->plug) { /* This protocol is a plugin */ prpl_accounts[p->protocol]--; - debug_printf("Protocol %s now in use by %d connections.\n", p->name, prpl_accounts[p->protocol]); + debug_printf("Protocol %s refcount now %d\n", p->name, prpl_accounts[p->protocol]); if(prpl_accounts[p->protocol] == 0) { /* No longer needed */ debug_printf("Throwing out %s protocol plugin\n", p->name); do_ask_cancel_by_handle(p->plug->handle);