Attempts to debug an issue that causes files to load up with twice the

number of actual frames.
This commit is contained in:
Collin Kidder
2016-01-28 20:56:26 -05:00
parent 763b20136e
commit 6c143049c5
+11 -3
View File
@@ -362,19 +362,27 @@ void CANFrameModel::sendBulkRefresh(int num)
//of how many by tracking the number we last knew about as opposed to how many rows there //of how many by tracking the number we last knew about as opposed to how many rows there
//are now. //are now.
num = filteredFrames.count() - lastUpdateNumFrames; num = filteredFrames.count() - lastUpdateNumFrames;
lastUpdateNumFrames += num; //done this way to avoid asking for filteredFrames.count() again
if (num < 0) return;
//qDebug() << "Num: " << num;
if (num == 0 && !overwriteDups) return; if (num == 0 && !overwriteDups) return;
if (filteredFrames.count() == 0) return; if (filteredFrames.count() == 0) return;
lastUpdateNumFrames += num; //done this way to avoid asking for filteredFrames.count() again
qDebug() << "Bulk refresh of " << num; qDebug() << "Bulk refresh of " << num;
if (!overwriteDups) if (!overwriteDups)
{ {
mutex.lock(); mutex.lock();
if (num > filteredFrames.count()) num = filteredFrames.count(); if (num > filteredFrames.count()) num = filteredFrames.count();
beginInsertRows(QModelIndex(), filteredFrames.count() - num, filteredFrames.count() - 1); //qDebug() << "From " << (filteredFrames.count() - num) << " to " << (filteredFrames.count() - 1);
endInsertRows(); //beginInsertRows(QModelIndex(), filteredFrames.count() - num, filteredFrames.count() - 1);
//endInsertRows();
beginResetModel();
endResetModel();
mutex.unlock(); mutex.unlock();
} }
else else