Icon: solve threading issue on when the source is http
Summary:
For starters, QQmlEngine::networkAccessManager is not reentrant and
would give
us a warning along the lines of:
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 polish, so
downloading the image will be handled by the main thread and we will
only be grabbing it from an already prepared QImage.
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.
Reviewers: Kirigami, mart, davidedmundson
Reviewed By: davidedmundson
Subscribers: davidedmundson, anthonyfieroni, bcooksley, plasma-devel
Tags: Kirigami
Differential Revision: https://phabricator.kde.org/D25185