summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Leinir Turthra Jensen <[email protected]>2017-04-18 13:27:41 +0100
committerDan Leinir Turthra Jensen <[email protected]>2017-04-18 13:27:41 +0100
commit639bf33c019266fab13286f0e0811b5a7f133c72 (patch)
tree4d25ab0d0192a2e3e5b7936673e41be49f6de7fb
parent85ffb0cf458f3516f3004aac7fe1f81489ee288e (diff)
Queue some connections which cannot be autodetected
Some of the connections we make are doing cross-thread calls, but in functions which exist on objects which live inside the same thread. Consequently, connect can't auto-detect that they need to be queued, and we end up sometimes (and during searches regularly) crashing because updates happen at the wrong time. I am unsure whether this is quite all of them, but with this patch the search functionality is much less crashy. Differential Revision: https://phabricator.kde.org/D5409
-rw-r--r--libdiscover/backends/KNSBackend/KNSBackend.cpp4
-rw-r--r--libdiscover/backends/PackageKitBackend/PackageKitBackend.cpp2
2 files changed, 3 insertions, 3 deletions
diff --git a/libdiscover/backends/KNSBackend/KNSBackend.cpp b/libdiscover/backends/KNSBackend/KNSBackend.cpp
index 91668a5..f4eae0e 100644
--- a/libdiscover/backends/KNSBackend/KNSBackend.cpp
+++ b/libdiscover/backends/KNSBackend/KNSBackend.cpp
@@ -118,7 +118,7 @@ KNSBackend::KNSBackend(QObject* parent, const QString& iconName, const QString &
this->setFetching(false);
qWarning() << "kns error" << objectName() << error;
});
- connect(m_engine, &KNSCore::Engine::signalEntriesLoaded, this, &KNSBackend::receivedEntries);
+ connect(m_engine, &KNSCore::Engine::signalEntriesLoaded, this, &KNSBackend::receivedEntries, Qt::QueuedConnection);
connect(m_engine, &KNSCore::Engine::signalEntryChanged, this, &KNSBackend::statusChanged);
connect(m_engine, &KNSCore::Engine::signalEntryDetailsLoaded, this, &KNSBackend::statusChanged);
m_page = -1;
@@ -332,7 +332,7 @@ ResultsStream * KNSBackend::searchStream(const QString &searchText)
connect(this, &KNSBackend::startingSearch, stream, &ResultsStream::deleteLater);
};
if (m_responsePending) {
- connect(this, &KNSBackend::availableForQueries, stream, start);
+ connect(this, &KNSBackend::availableForQueries, stream, start, Qt::QueuedConnection);
} else {
start();
}
diff --git a/libdiscover/backends/PackageKitBackend/PackageKitBackend.cpp b/libdiscover/backends/PackageKitBackend/PackageKitBackend.cpp
index 67649f1..c6beeff 100644
--- a/libdiscover/backends/PackageKitBackend/PackageKitBackend.cpp
+++ b/libdiscover/backends/PackageKitBackend/PackageKitBackend.cpp
@@ -419,7 +419,7 @@ ResultsStream* PackageKitBackend::search(const AbstractResourcesBackend::Filters
stream->resourcesFound(kFilter<QVector<AbstractResource*>>(res, [ids](AbstractResource* res){ return !ids.contains(res->appstreamId()); }));
}
stream->deleteLater();
- });
+ }, Qt::QueuedConnection);
return stream;
}
}