Commit e96f7dbb authored by Joris Guisson's avatar Joris Guisson
Browse files

Merged rev 796066 (multiple torrents removal crash fix)

svn path=/branches/ktorrent/3.0/; revision=796070
parent c875c1bc
...@@ -10,6 +10,7 @@ Changes in 3.0.2 : ...@@ -10,6 +10,7 @@ Changes in 3.0.2 :
- Fix update search engines from internet - Fix update search engines from internet
- Remove torrentspy and update piratebay URL - Remove torrentspy and update piratebay URL
- Fix 4 GB limit in transfer of statusbar (160711) - Fix 4 GB limit in transfer of statusbar (160711)
- Fix crash when removing 2 torrents at the same time
Changes in 3.0.1 : Changes in 3.0.1 :
- Fix sessionTTL not being able to be bigger then 99 - Fix sessionTTL not being able to be bigger then 99
......
...@@ -37,7 +37,7 @@ namespace kt ...@@ -37,7 +37,7 @@ namespace kt
QDBusConnection::ExportScriptableSlots|QDBusConnection::ExportScriptableSignals); QDBusConnection::ExportScriptableSlots|QDBusConnection::ExportScriptableSignals);
connect(core,SIGNAL(torrentAdded(bt::TorrentInterface*)),this,SLOT(torrentAdded(bt::TorrentInterface*))); connect(core,SIGNAL(torrentAdded(bt::TorrentInterface*)),this,SLOT(torrentAdded(bt::TorrentInterface*)));
connect(core,SIGNAL(torrentRemoved(bt::TorrentInterface*)),this,SLOT(torrentAdded(bt::TorrentInterface*))); connect(core,SIGNAL(torrentRemoved(bt::TorrentInterface*)),this,SLOT(torrentRemoved(bt::TorrentInterface*)));
// fill the map with torrents // fill the map with torrents
torrents(); torrents();
} }
......
...@@ -384,7 +384,7 @@ namespace kt ...@@ -384,7 +384,7 @@ namespace kt
QVariant ViewModel::data(const QModelIndex & index, int role) const QVariant ViewModel::data(const QModelIndex & index, int role) const
{ {
if (!index.isValid() || index.row() >= torrents.count()) if (!index.isValid() || index.row() >= torrents.count() || index.row() < 0)
return QVariant(); return QVariant();
if (role == Qt::ForegroundRole) if (role == Qt::ForegroundRole)
...@@ -399,7 +399,7 @@ namespace kt ...@@ -399,7 +399,7 @@ namespace kt
Qt::ItemFlags ViewModel::flags(const QModelIndex & index) const Qt::ItemFlags ViewModel::flags(const QModelIndex & index) const
{ {
if (!index.isValid() || index.row() >= torrents.count()) if (!index.isValid() || index.row() >= torrents.count() || index.row() < 0)
return QAbstractTableModel::flags(index); return QAbstractTableModel::flags(index);
else else
return QAbstractTableModel::flags(index) | Qt::ItemIsDragEnabled; return QAbstractTableModel::flags(index) | Qt::ItemIsDragEnabled;
...@@ -436,7 +436,7 @@ namespace kt ...@@ -436,7 +436,7 @@ namespace kt
{ {
foreach (QModelIndex i,idx) foreach (QModelIndex i,idx)
{ {
if (i.row() < torrents.count()) if (i.isValid())
{ {
tlist.append(torrents[i.row()].tc); tlist.append(torrents[i.row()].tc);
} }
...@@ -445,7 +445,7 @@ namespace kt ...@@ -445,7 +445,7 @@ namespace kt
const bt::TorrentInterface* ViewModel::torrentFromIndex(const QModelIndex & index) const const bt::TorrentInterface* ViewModel::torrentFromIndex(const QModelIndex & index) const
{ {
if (index.isValid() && index.row() < torrents.count()) if (index.isValid() && index.row() < torrents.count() && index.row() >= 0)
return torrents[index.row()].tc; return torrents[index.row()].tc;
else else
return 0; return 0;
...@@ -453,7 +453,7 @@ namespace kt ...@@ -453,7 +453,7 @@ namespace kt
bt::TorrentInterface* ViewModel::torrentFromIndex(const QModelIndex & index) bt::TorrentInterface* ViewModel::torrentFromIndex(const QModelIndex & index)
{ {
if (index.isValid() && index.row() < torrents.count()) if (index.isValid() && index.row() < torrents.count() && index.row() >= 0)
return torrents[index.row()].tc; return torrents[index.row()].tc;
else else
return 0; return 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment