Queue some connections which cannot be autodetected
ClosedPublic

Authored by leinir on Apr 12 2017, 11:38 AM.

Details

Summary

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.

Diff Detail

Repository
R134 Discover Software Store
Lint
Lint Skipped
Unit
Unit Tests Skipped
leinir created this revision.Apr 12 2017, 11:38 AM
Restricted Application added a project: Plasma. · View Herald TranscriptApr 12 2017, 11:38 AM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
apol edited edge metadata.Apr 12 2017, 12:00 PM

Are you sure? Which other threads? From the rendering?

In D5409#101510, @apol wrote:

Are you sure? Which other threads? From the rendering?

Yeah, the crashes happen when forwarding the data updates to the view, which has potentially changed in the meantime.

apol added inline comments.Apr 12 2017, 1:28 PM
libdiscover/backends/KNSBackend/KNSBackend.cpp
330 ↗(On Diff #13350)

Then maybe it's KNS that should be syncing?
i.e. connect(m_engine, &KNSCore::Engine::signalEntriesLoaded, this, &KNSBackend::receivedEntries);

Or even have KNSCore emit from the object's thread:
http://doc.qt.io/qt-5/threads-qobject.html#signals-and-slots-across-threads

apol requested changes to this revision.Apr 12 2017, 4:13 PM
This revision now requires changes to proceed.Apr 12 2017, 4:13 PM
leinir marked an inline comment as done.Apr 13 2017, 1:03 PM
leinir added inline comments.
libdiscover/backends/KNSBackend/KNSBackend.cpp
330 ↗(On Diff #13350)

This requires a fix in KNS, which has been pushed to master. We now require (current) master of KNS, so i'll update that for the cmake package find bit as well :)

leinir updated this revision to Diff 13386.Apr 13 2017, 1:08 PM
leinir edited edge metadata.
leinir marked an inline comment as done.

Changed the KNS backend's main queued connection to somewhere a tiny bit more central. This causes us to require KNewStuff master, but we already require a bunch of master stuff elsewhere, so, you know, not so big an issue anyway :)

apol accepted this revision.Apr 18 2017, 12:18 PM

Go for it, let's see how it goes.

This revision is now accepted and ready to land.Apr 18 2017, 12:18 PM
This revision was automatically updated to reflect the committed changes.