fix image loader scrollbar crash (#129)

* fix image loader scrollbar crash
This commit is contained in:
hemirt 2017-10-11 14:46:56 +02:00 committed by pajlada
parent 0ef6fdfef9
commit bdee9fff70
3 changed files with 7 additions and 3 deletions

View file

@ -43,6 +43,8 @@ void ImageLoaderManager::queue(chatterino::messages::LazyLoadedImage *lli)
QObject::connect(&requester, &ImageLoaderRequester::request, worker, QObject::connect(&requester, &ImageLoaderRequester::request, worker,
&ImageLoaderWorker::handleRequest); &ImageLoaderWorker::handleRequest);
QObject::connect(worker, &ImageLoaderWorker::done, lli,
[lli]() { lli->windowManager.layoutVisibleChatWidgets(); });
emit requester.request(lli, &this->NaM); emit requester.request(lli, &this->NaM);
} }
@ -80,9 +82,9 @@ void ImageLoaderWorker::handleLoad(chatterino::messages::LazyLoadedImage *lli, Q
} }
lli->emoteManager.incGeneration(); lli->emoteManager.incGeneration();
lli->windowManager.layoutVisibleChatWidgets();
reply->deleteLater(); reply->deleteLater();
emit this->done();
delete this; delete this;
} }

View file

@ -15,6 +15,9 @@ class ImageLoaderWorker : public QObject
public slots: public slots:
void handleRequest(chatterino::messages::LazyLoadedImage *lli, QNetworkAccessManager *nam); void handleRequest(chatterino::messages::LazyLoadedImage *lli, QNetworkAccessManager *nam);
void handleLoad(LazyLoadedImage *lli, QNetworkReply *reply); void handleLoad(LazyLoadedImage *lli, QNetworkReply *reply);
signals:
void done();
}; };
class ImageLoaderRequester : public QObject class ImageLoaderRequester : public QObject

View file

@ -10,8 +10,6 @@ class WindowManager;
namespace messages { namespace messages {
class ImageLoaderManager;
class LazyLoadedImage : public QObject class LazyLoadedImage : public QObject
{ {
public: public:
@ -68,6 +66,7 @@ private:
void gifUpdateTimout(); void gifUpdateTimout();
friend class ImageLoaderWorker; friend class ImageLoaderWorker;
friend class ImageLoaderManager;
}; };
} // namespace messages } // namespace messages