apol created this revision. apol added reviewers: Kirigami, mart. Herald added a project: Kirigami. Herald added a subscriber: plasma-devel. apol requested review of this revision.
REVISION SUMMARY For starters, QQmlEngine::networkAccessManager is not reentrant and would give us a warning along the lines of: discover(68504)/ QObject::QObject|QNetworkAccessManager::QNetworkAccessManager QObject: Cannot create children for a parent that is in a different thread. (Parent is QQmlApplicationEngine(0x5563bf8dcad0), parent's thread is QThread(0x5563bf825f70), current thread is QSGRenderThread(0x5563bfef7830) That happens because Icon::findIcon is called from Icon::updatePaintNode which is called from the render thread. This patch changes it so the QNAM bits happen upon setSource, so downloading the image will be handled by the main thread and we will only be grabbing it from an already prepared QImage. This patch also includes a QMutex, to keep both threads split. TEST PLAN I don't get the warning anymore and if I agressively scroll I don't get crashes. This will potentially fix a bunch of bugs in Discover since we use extensively Kirigami.Icon + http. REPOSITORY R169 Kirigami BRANCH master REVISION DETAIL https://phabricator.kde.org/D25185 AFFECTED FILES src/icon.cpp src/icon.h To: apol, #kirigami, mart Cc: plasma-devel, fbampaloukas, GB_2, domson, dkardarakos, ngraham, apol, ahiemstra, davidedmundson, mart, hein