fix another crash-on-shutdown in the new web code

This commit is contained in:
Charles Kerr 2008-04-28 13:29:38 +00:00
parent b9c27b23d5
commit 1dfc98fc77
3 changed files with 12 additions and 11 deletions

View File

@ -385,18 +385,14 @@ tr_torrentCount( const tr_handle * h )
}
static void
tr_closeImpl( void * vh )
tr_closeAllConnections( void * vh )
{
tr_handle * h = vh;
tr_torrent * t;
tr_webClose( h->web );
tr_sharedShuttingDown( h->shared );
tr_trackerShuttingDown( h );
_tr_blocklistFree( h->blocklist );
h->blocklist = NULL;
for( t=h->torrentList; t!=NULL; ) {
tr_torrent * tmp = t;
t = t->next;
@ -428,10 +424,14 @@ tr_close( tr_handle * h )
tr_statsClose( h );
tr_runInEventThread( h, tr_closeImpl, h );
tr_runInEventThread( h, tr_closeAllConnections, h );
while( !h->isClosed && !deadlineReached( deadline ) )
tr_wait( 100 );
_tr_blocklistFree( h->blocklist );
h->blocklist = NULL;
tr_webClose( &h->web );
tr_eventClose( h );
while( h->events && !deadlineReached( deadline ) )
tr_wait( 100 );

View File

@ -319,12 +319,13 @@ tr_webInit( tr_session * session )
}
void
tr_webClose( tr_web * web )
tr_webClose( tr_web ** web )
{
dbgmsg( "deleting web->timer" );
evtimer_del( &web->timer );
curl_multi_cleanup( web->cm );
tr_free( web );
evtimer_del( &(*web)->timer );
curl_multi_cleanup( (*web)->cm );
tr_free( *web );
*web = NULL;
}
/***

View File

@ -18,7 +18,7 @@ typedef struct tr_web tr_web;
tr_web* tr_webInit( tr_handle * session );
void tr_webClose( tr_web * );
void tr_webClose( tr_web ** );
typedef void (tr_web_done_func)( tr_handle * session,
long response_code,