Plugin - gtkblist unhiding event problem

Sławek Mikuła slawek.mikula at gmail.com
Mon Sep 3 16:09:15 EDT 2007


Hello everyone !,

 I'm an author of a small plugin for gaim. It's details are on the
following page http://slawek.mikula.googlepages.com/gaim_showoffline.
For the last release i've been using gaim 2.0b3 and everything with the
code was fine. Few weeks ago i've upgraded to the Ubuntu Feisty and i've
found that this plugin is broken with the 2.0b6 code. I've also got the
latest stable Piging code (2.1.1) and port the plugin to the new
pidgin/purple code. Unfortunately the same error arises. 

 These are the symptoms: The plugin shows users which has got
description set and with the offline mode set for the buddy protocol
(common mode for people in invisible mode). I would like to show them
even when i've got "show only active" people. For this i've registered
events for buddy status change. After some time i've discovered that
this is not enough, and registered also the gtkblist unhiding event. And
with this one I've got segfaults.

The code is below (for gaim):

--- CUT ---

/** callback for buddy list show event
 * 
 * @param blist : buddyList object
 */ 
static void
gtkblist_unhiding_cb(PurpleBuddyList *blist)
{
  PurpleBlistNode *gnode, *cnode, *bnode;
  PurpleBuddy *buddy;

  /* check recursively for buddy state */
  for (gnode = blist->root; gnode != NULL; gnode = gnode->next)
  {
  	if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) {
		continue;
        }
        for (cnode = gnode->child; cnode != NULL; cnode = cnode->next)
	{
	  if (!PURPLE_BLIST_NODE_IS_CONTACT(cnode)) {
	    continue;
          }

	  for (bnode = cnode->child; bnode != NULL; bnode = bnode->next)
	  {
	    if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) {
	      continue;
            }

            buddy = (PurpleBuddy *)bnode;
	    check_message_set(buddy);
	  }
	}
  }
}
--- CUT ---

I'm iterating through all of buddy list and when the buddy has set
message, I'm showing him on the list (the check_message_set function).

After registering plugin and running it through gdb i've got segfault:

-- CUT ---
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1223436064 (LWP 14021)]
0xb66018a6 in gtkblist_unhiding_cb (blist=0x82aed00) at
showoffline.c:115
115  for (gnode = blist->root; gnode != NULL; gnode = gnode->next)
(gdb) quit

-- CUT ---

What's wrong with this code ? Maybe there is another way of checking all
of the buddies (needed for my plugin).

thanks in advance,
-- 
Slawek Mikula <zorba at silesianet.pl>
or 
slawek dot. mikula at@ gmail dot. com





More information about the Devel mailing list