(trunk gtk) fix crash when leaving the properties dialog open during shutdown

This commit is contained in:
Charles Kerr 2009-06-15 00:01:38 +00:00
parent deb679dab0
commit 2e23c8fade
1 changed files with 13 additions and 7 deletions

View File

@ -115,14 +115,20 @@ getTorrents( struct DetailsImpl * d, int * setmeCount )
int n = g_slist_length( d->ids );
int torrentCount = 0;
tr_session * session = tr_core_session( d->core );
tr_torrent ** torrents = g_new( tr_torrent*, n );
GSList * l;
tr_torrent ** torrents = NULL;
for( l=d->ids; l!=NULL; l=l->next ) {
const int id = GPOINTER_TO_INT( l->data );
tr_torrent * tor = tr_torrentFindFromId( session, id );
if( tor )
torrents[torrentCount++] = tor;
if( session != NULL )
{
GSList * l;
torrents = g_new( tr_torrent*, n );
for( l=d->ids; l!=NULL; l=l->next ) {
const int id = GPOINTER_TO_INT( l->data );
tr_torrent * tor = tr_torrentFindFromId( session, id );
if( tor )
torrents[torrentCount++] = tor;
}
}
*setmeCount = torrentCount;