Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Stop QImageReader from asserting when creating large thumbnails for KRA

Joshua Goinsf98090138bb5
diff --git a/krita/main.cc b/krita/main.cc
index 77535b331f..475b1bc208 100644
--- a/krita/main.cc
+++ b/krita/main.cc
@@ -31,6 +31,7 @@
#include <QString>
#include <QThread>
#include <QTranslator>
+#include <QImageReader>
#include <KisApplication.h>
#include <KisMainWindow.h>
@@ -269,6 +270,12 @@ extern "C" MAIN_EXPORT int MAIN_FN(int argc, char **argv)
QCoreApplication::setAttribute(Qt::AA_DisableShaderDiskCache, true);
+ // In Qt6, QImageReader has an allocation limit to prevent large memory allocations.
+ // However in Qt5 this doesn't exist, and can easily trigger in KisFileIconCreator while creating icons on large thumbnails.
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+ QImageReader::setAllocationLimit(0);
+#endif
+
#ifdef HAVE_HIGH_DPI_SCALE_FACTOR_ROUNDING_POLICY
// This rounding policy depends on a series of patches to Qt related to
// https://bugreports.qt.io/browse/QTBUG-53022. These patches are applied