diff options
author | flow <flowlnlnln@gmail.com> | 2022-11-15 18:13:15 -0300 |
---|---|---|
committer | flow <flowlnlnln@gmail.com> | 2022-11-15 18:14:03 -0300 |
commit | c4c1e75de8825a4af403046536a7b2acd72a56c3 (patch) | |
tree | 4c7ca26e214f1aa8a58d08a3a7f6f396c417876d /launcher/minecraft/mod/ResourcePack.cpp | |
parent | 7705f290ca69c0478f698ddf06a5f1edb731e8fc (diff) | |
download | PrismLauncher-c4c1e75de8825a4af403046536a7b2acd72a56c3.tar.gz PrismLauncher-c4c1e75de8825a4af403046536a7b2acd72a56c3.tar.bz2 PrismLauncher-c4c1e75de8825a4af403046536a7b2acd72a56c3.zip |
fix: use QPixmapCache only from the main thread
It's a required condition.
Signed-off-by: flow <flowlnlnln@gmail.com>
Diffstat (limited to 'launcher/minecraft/mod/ResourcePack.cpp')
-rw-r--r-- | launcher/minecraft/mod/ResourcePack.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/launcher/minecraft/mod/ResourcePack.cpp b/launcher/minecraft/mod/ResourcePack.cpp index b97bedf8..242fd9fe 100644 --- a/launcher/minecraft/mod/ResourcePack.cpp +++ b/launcher/minecraft/mod/ResourcePack.cpp @@ -1,9 +1,11 @@ #include "ResourcePack.h" +#include <QCoreApplication> #include <QDebug> #include <QMap> #include <QRegularExpression> +#include "MTPixmapCache.h" #include "Version.h" #include "minecraft/mod/tasks/LocalResourcePackParseTask.h" @@ -43,9 +45,9 @@ void ResourcePack::setImage(QImage new_image) Q_ASSERT(!new_image.isNull()); if (m_pack_image_cache_key.key.isValid()) - QPixmapCache::remove(m_pack_image_cache_key.key); + PixmapCache::instance().remove(m_pack_image_cache_key.key); - m_pack_image_cache_key.key = QPixmapCache::insert(QPixmap::fromImage(new_image)); + m_pack_image_cache_key.key = PixmapCache::instance().insert(QPixmap::fromImage(new_image)); m_pack_image_cache_key.was_ever_used = true; // This can happen if the pixmap is too big to fit in the cache :c @@ -58,7 +60,7 @@ void ResourcePack::setImage(QImage new_image) QPixmap ResourcePack::image(QSize size) { QPixmap cached_image; - if (QPixmapCache::find(m_pack_image_cache_key.key, &cached_image)) { + if (PixmapCache::instance().find(m_pack_image_cache_key.key, &cached_image)) { if (size.isNull()) return cached_image; return cached_image.scaled(size); |