diff options
| author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-07-29 19:08:16 +0200 | 
|---|---|---|
| committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-07-29 19:08:16 +0200 | 
| commit | 2fe5eb939ff77697b578bf45ba23cd99daee9c5f (patch) | |
| tree | 3a13b9bb3b9cde7fc81f325170a30daac1711688 /irc_channel.c | |
| parent | b40e60db39f0b187774cfd2e0fe1b503f9bf1a54 (diff) | |
Clean up references from irc_user structs to channels that are being free()d.
Diffstat (limited to 'irc_channel.c')
| -rw-r--r-- | irc_channel.c | 9 | 
1 files changed, 9 insertions, 0 deletions
| diff --git a/irc_channel.c b/irc_channel.c index 5d504f66..7d805014 100644 --- a/irc_channel.c +++ b/irc_channel.c @@ -116,6 +116,7 @@ irc_channel_t *irc_channel_get( irc_t *irc, char *id )  int irc_channel_free( irc_channel_t *ic )  {  	irc_t *irc = ic->irc; +	GSList *l;  	if( ic->flags & IRC_CHANNEL_JOINED )  		irc_channel_del_user( ic, irc->user, IRC_CDU_KICK, "Cleaning up channel" ); @@ -133,6 +134,14 @@ int irc_channel_free( irc_channel_t *ic )  		ic->users = g_slist_remove( ic->users, ic->users->data );  	} +	for( l = irc->users; l; l = l->next ) +	{ +		irc_user_t *iu = l->data; +		 +		if( iu->last_channel == ic ) +			iu->last_channel = irc->default_channel; +	} +	  	g_free( ic->name );  	g_free( ic->topic );  	g_free( ic->topic_who ); | 
