From 7582f4a929f2eb3c4cde6b6b6b74af1694048507 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Thu, 13 Dec 2007 21:48:39 +0000 Subject: [PATCH] (maybe) fix shutdown crash in "pulse" reported by pea_ --- libtransmission/tracker.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/libtransmission/tracker.c b/libtransmission/tracker.c index f6d90f56b..62ef5fdbe 100644 --- a/libtransmission/tracker.c +++ b/libtransmission/tracker.c @@ -904,6 +904,9 @@ pulse( void * vhandle ) tr_torrent * tor; const time_t now = time( NULL ); + if( handle->tracker == NULL ) + return FALSE; + if( handle->tracker->socketCount || tr_list_size(th->requestQueue) || tr_list_size(th->scrapeQueue) ) dbgmsg( NULL, "tracker pulse... %d sockets, %d reqs left, %d scrapes left", handle->tracker->socketCount, tr_list_size(th->requestQueue), tr_list_size(th->scrapeQueue) ); @@ -941,9 +944,12 @@ pulse( void * vhandle ) static void onReqDone( tr_handle * handle ) { - pulse( handle ); - --handle->tracker->socketCount; - dbgmsg( NULL, "decrementing socket count to %d", handle->tracker->socketCount ); + if( handle->tracker ) + { + pulse( handle ); + --handle->tracker->socketCount; + dbgmsg( NULL, "decrementing socket count to %d", handle->tracker->socketCount ); + } } /***