From 427b2cf3268fd056aef38b1d25334617204afd0b Mon Sep 17 00:00:00 2001 From: Collin Kidder Date: Mon, 25 Jan 2016 20:02:20 -0500 Subject: [PATCH] Fixed bugs in connect/disconnect and overwrite mode. --- canframemodel.cpp | 16 +++++++++------- config.h | 2 +- serialworker.cpp | 3 ++- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/canframemodel.cpp b/canframemodel.cpp index 39722fb..ed8f17a 100644 --- a/canframemodel.cpp +++ b/canframemodel.cpp @@ -115,6 +115,8 @@ void CANFrameModel::recalcOverwrite() { if (!overwriteDups) return; //no need to do a thing if mode is disabled + qDebug() << "recalcOverwrite called in model"; + int lastUnique = 0; bool found; @@ -362,24 +364,24 @@ void CANFrameModel::sendBulkRefresh(int num) num = filteredFrames.count() - lastUpdateNumFrames; lastUpdateNumFrames += num; //done this way to avoid asking for filteredFrames.count() again - //qDebug() << "Bulk refresh of " << num; - - if (num == 0) return; + if (num == 0 && !overwriteDups) return; if (filteredFrames.count() == 0) return; - mutex.lock(); + qDebug() << "Bulk refresh of " << num; if (!overwriteDups) { + mutex.lock(); if (num > filteredFrames.count()) num = filteredFrames.count(); beginInsertRows(QModelIndex(), filteredFrames.count() - num, filteredFrames.count() - 1); endInsertRows(); + mutex.unlock(); } else { - sendRefresh(); - } - mutex.unlock(); + beginResetModel(); + endResetModel(); + } } void CANFrameModel::clearFrames() diff --git a/config.h b/config.h index c78ea75..de7d50d 100644 --- a/config.h +++ b/config.h @@ -1,7 +1,7 @@ #ifndef CONFIG #define CONFIG -#define VERSION 148 +#define VERSION 149 //try to keep this in sync. //SavvyCAN will complain if you connect a GVRET board with a revision diff --git a/serialworker.cpp b/serialworker.cpp index 51cea4a..d6d695d 100644 --- a/serialworker.cpp +++ b/serialworker.cpp @@ -477,7 +477,8 @@ void SerialWorker::closeSerialPort() serial->close(); } serial->disconnect(); - ticker->stop(); + //do not stop the ticker here. It always stays running now. + //ticker->stop(); delete serial; serial = NULL; }