Browse Source

Just disconnect for the old reader's signals to ignore all future events from it

Girish Ramakrishnan 8 years ago
parent
commit
135bc1dcdd
1 changed files with 2 additions and 3 deletions
  1. 2 3
      mediamodel.cpp

+ 2 - 3
mediamodel.cpp

@@ -415,9 +415,7 @@ static QPixmap loadThumbnail(const QByteArray &data)
 
 void MediaModel::handleDataReady(MediaDbReader *reader, const QList<QSqlRecord> &records, Node *loadingNode)
 {
-    if (reader != m_reader) // stale event?
-        return;
-
+    Q_ASSERT(reader == m_reader);
     DEBUG << "Received response from db of size " << records.size();
 
     QList<Node *> newChildren;
@@ -492,6 +490,7 @@ void MediaModel::groupBy(MediaModel::GroupBy groupBy)
 
     MediaDbReader *newReader = new MediaDbReader;
     if (m_reader) {
+        disconnect(m_reader, 0, this, 0);
         m_reader->stop();
         m_reader->deleteLater();
     }