Changeset d33679e


Ignore:
Timestamp:
2010-04-14T12:17:12Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
d7d677d
Parents:
21c87a7
Message:

Call bee_free() from irc_free() or daemon mode gets pretty sad.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • irc.c

    r21c87a7 rd33679e  
    198198        log_message( LOGLVL_INFO, "Destroying connection with fd %d", irc->fd );
    199199       
    200         /*
    201200        if( irc->status & USTATUS_IDENTIFIED && set_getbool( &irc->b->set, "save_on_quit" ) )
    202201                if( storage_save( irc, NULL, TRUE ) != STORAGE_OK )
    203                         irc_usermsg( irc, "Error while saving settings!" );
    204         */
     202                        log_message( LOGLVL_WARNING, "Error while saving settings for user %s", irc->user->nick );
    205203       
    206204        irc_connection_list = g_slist_remove( irc_connection_list, irc );
    207205       
    208         /*
    209206        while( irc->queries != NULL )
    210207                query_del( irc, irc->queries );
    211         */
     208       
     209        /* This is a little bit messy: bee_free() frees all b->users which
     210           calls us back to free the corresponding irc->users. So do this
     211           before we clear the remaining ones ourselves. */
     212        bee_free( irc->b );
    212213       
    213214        while( irc->users )
     
    240241        g_free( irc->sendbuffer );
    241242        g_free( irc->readbuffer );
    242        
    243243        g_free( irc->password );
    244244       
  • protocols/bee.c

    r21c87a7 rd33679e  
    5252void bee_free( bee_t *b )
    5353{
    54         account_t *acc = b->accounts;
    55        
    56         while( acc )
     54        while( b->accounts )
    5755        {
    58                 if( acc->ic )
    59                         imc_logout( acc->ic, FALSE );
    60                 else if( acc->reconnect )
    61                         cancel_auto_reconnect( acc );
     56                if( b->accounts->ic )
     57                        imc_logout( b->accounts->ic, FALSE );
     58                else if( b->accounts->reconnect )
     59                        cancel_auto_reconnect( b->accounts );
    6260               
    63                 if( acc->ic == NULL )
    64                         account_del( b, acc );
     61                if( b->accounts->ic == NULL )
     62                        account_del( b, b->accounts );
    6563                else
    6664                        /* Nasty hack, but account_del() doesn't work in this
    6765                           case and we don't want infinite loops, do we? ;-) */
    68                         acc = acc->next;
     66                        b->accounts = b->accounts->next;
    6967        }
    7068       
Note: See TracChangeset for help on using the changeset viewer.