#879: fix segfault if tracker is freed immediately after starting a torrent

This commit is contained in:
Charles Kerr 2008-04-15 15:51:59 +00:00
parent 401c98536e
commit 29cb590c28
1 changed files with 18 additions and 14 deletions

View File

@ -1141,17 +1141,17 @@ onTrackerFreeNow( void * vt )
tr_free( t );
}
void
tr_trackerFree( tr_tracker * t )
{
tr_runInEventThread( t->handle, onTrackerFreeNow, t );
}
/***
**** PUBLIC
***/
void
tr_trackerFree( tr_tracker * t )
{
if( t )
tr_runInEventThread( t->handle, onTrackerFreeNow, t );
}
tr_publisher_tag
tr_trackerSubscribe( tr_tracker * t,
tr_delivery_func func,
@ -1164,6 +1164,7 @@ void
tr_trackerUnsubscribe( tr_tracker * t,
tr_publisher_tag tag )
{
if( t )
tr_publisherUnsubscribe( t->publisher, tag );
}
@ -1205,6 +1206,8 @@ tr_trackerGetCounts( const tr_tracker * t,
void
tr_trackerStart( tr_tracker * t )
{
if( t )
{
tr_free( t->peer_id );
t->peer_id = tr_peerIdNew( );
@ -1214,6 +1217,7 @@ tr_trackerStart( tr_tracker * t )
enqueueRequest( t->handle, t, TR_REQ_STARTED );
}
}
}
void
tr_trackerReannounce( tr_tracker * t )
@ -1230,7 +1234,7 @@ tr_trackerCompleted( tr_tracker * t )
void
tr_trackerStop( tr_tracker * t )
{
if( t->isRunning ) {
if( t && t->isRunning ) {
t->isRunning = 0;
t->reannounceAt = t->manualAnnounceAllowedAt = 0;
enqueueRequest( t->handle, t, TR_REQ_STOPPED );