(trunk Qt) #2298: qtr client crashes when expired torrent is removed

This commit is contained in:
Charles Kerr 2009-10-10 00:39:38 +00:00
parent 11befebac5
commit 7bd3e0c297
1 changed files with 14 additions and 12 deletions

View File

@ -718,7 +718,7 @@ TrMainWindow :: refreshStatusBar( )
str = tr( "Down: %1, Up: %2" ).arg( Utils :: sizeToString( stats.downloadedBytes ) )
.arg( Utils :: sizeToString( stats.uploadedBytes ) );
}
else /* default is "total-ratio" */
else // default is "total-ratio"
{
str = tr( "Ratio: %1" ).arg( Utils :: ratioToString( mySession.getCumulativeStats().ratio ) );
}
@ -737,21 +737,23 @@ TrMainWindow :: refreshActionSensitivity( )
const QItemSelectionModel * selectionModel( ui.listView->selectionModel( ) );
const int rowCount( model->rowCount( ) );
/* count how many torrents are selected, paused, etc */
// count how many torrents are selected, paused, etc
for( int row=0; row<rowCount; ++row ) {
const QModelIndex modelIndex( model->index( row, 0 ) );
assert( model == modelIndex.model( ) );
const Torrent * tor( model->data( modelIndex, TorrentModel::TorrentRole ).value<const Torrent*>( ) );
const bool isSelected( selectionModel->isSelected( modelIndex ) );
const bool isPaused( tor->isPaused( ) );
if( isSelected )
++selected;
if( isPaused )
++ paused;
if( isSelected && isPaused )
++selectedAndPaused;
if( tor->canManualAnnounce( ) )
++canAnnounce;
if( tor ) {
const bool isSelected( selectionModel->isSelected( modelIndex ) );
const bool isPaused( tor->isPaused( ) );
if( isSelected )
++selected;
if( isPaused )
++ paused;
if( isSelected && isPaused )
++selectedAndPaused;
if( tor->canManualAnnounce( ) )
++canAnnounce;
}
}
const bool haveSelection( selected > 0 );