diff --git a/src/messages/imageloadermanager.cpp b/src/messages/imageloadermanager.cpp index 735232297..f83521044 100644 --- a/src/messages/imageloadermanager.cpp +++ b/src/messages/imageloadermanager.cpp @@ -43,6 +43,8 @@ void ImageLoaderManager::queue(chatterino::messages::LazyLoadedImage *lli) QObject::connect(&requester, &ImageLoaderRequester::request, worker, &ImageLoaderWorker::handleRequest); + QObject::connect(worker, &ImageLoaderWorker::done, lli, + [lli]() { lli->windowManager.layoutVisibleChatWidgets(); }); emit requester.request(lli, &this->NaM); } @@ -80,9 +82,9 @@ void ImageLoaderWorker::handleLoad(chatterino::messages::LazyLoadedImage *lli, Q } lli->emoteManager.incGeneration(); - lli->windowManager.layoutVisibleChatWidgets(); reply->deleteLater(); + emit this->done(); delete this; } diff --git a/src/messages/imageloadermanager.hpp b/src/messages/imageloadermanager.hpp index 9f0f0250a..4894b538b 100644 --- a/src/messages/imageloadermanager.hpp +++ b/src/messages/imageloadermanager.hpp @@ -15,6 +15,9 @@ class ImageLoaderWorker : public QObject public slots: void handleRequest(chatterino::messages::LazyLoadedImage *lli, QNetworkAccessManager *nam); void handleLoad(LazyLoadedImage *lli, QNetworkReply *reply); + +signals: + void done(); }; class ImageLoaderRequester : public QObject diff --git a/src/messages/lazyloadedimage.hpp b/src/messages/lazyloadedimage.hpp index 50c544589..751ec98e7 100644 --- a/src/messages/lazyloadedimage.hpp +++ b/src/messages/lazyloadedimage.hpp @@ -10,8 +10,6 @@ class WindowManager; namespace messages { -class ImageLoaderManager; - class LazyLoadedImage : public QObject { public: @@ -68,6 +66,7 @@ private: void gifUpdateTimout(); friend class ImageLoaderWorker; + friend class ImageLoaderManager; }; } // namespace messages