mirror of
https://github.com/transmission/transmission
synced 2024-12-24 08:43:27 +00:00
#1476: crash on exit when stats window is open
This commit is contained in:
parent
a0fd42c5c3
commit
fa54f390ae
1 changed files with 13 additions and 12 deletions
|
@ -10,8 +10,6 @@
|
|||
* $Id$
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "transmission.h"
|
||||
#include "bencode.h"
|
||||
#include "platform.h" /* tr_sessionGetConfigDir() */
|
||||
|
@ -131,7 +129,7 @@ tr_statsClose( tr_handle * handle )
|
|||
static struct tr_stats_handle *
|
||||
getStats( const tr_handle * handle )
|
||||
{
|
||||
return handle->sessionStats;
|
||||
return handle ? handle->sessionStats : NULL;
|
||||
}
|
||||
|
||||
/***
|
||||
|
@ -163,11 +161,12 @@ tr_sessionGetStats( const tr_handle * handle,
|
|||
tr_session_stats * setme )
|
||||
{
|
||||
const struct tr_stats_handle * stats = getStats( handle );
|
||||
|
||||
assert( stats );
|
||||
*setme = stats->single;
|
||||
setme->secondsActive = time( NULL ) - stats->startTime;
|
||||
updateRatio( setme );
|
||||
if( stats )
|
||||
{
|
||||
*setme = stats->single;
|
||||
setme->secondsActive = time( NULL ) - stats->startTime;
|
||||
updateRatio( setme );
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -175,11 +174,13 @@ tr_sessionGetCumulativeStats( const tr_handle * handle,
|
|||
tr_session_stats * setme )
|
||||
{
|
||||
const struct tr_stats_handle * stats = getStats( handle );
|
||||
tr_session_stats current;
|
||||
tr_session_stats current;
|
||||
|
||||
assert( stats );
|
||||
tr_sessionGetStats( handle, ¤t );
|
||||
addStats( setme, &stats->old, ¤t );
|
||||
if( stats )
|
||||
{
|
||||
tr_sessionGetStats( handle, ¤t );
|
||||
addStats( setme, &stats->old, ¤t );
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in a new issue