QPixmapCache insert behaviour when insert fails
-
Hej there, I'm new here and hope to be welcome, anyway.
I did a (short) search for existence of my topic, but did not find some.
For my question I provide some background information first:We do develop some project using QT5.8, on Windows 10 with VS2015.
I do load a resource PNG file (3000x1781px ARGB) and QT tries to save it
in PixmapCache, more exactly in QPMCache module. The method insert is
called, but returns false as the size (21.7M is bigger than some
‘mx’), and the code from qt-everywhere-opensource-src-5.8.0/qtbase/src/gui/image/qpixmapcache.cpp
tells to remove the key that was inserted anyway, and then to release it, as follows.bool QPMCache::insert(const QString& key, const QPixmap &pixmap, int cost) { [ … ] } else { //Insertion failed we released the new allocated key (--!-->) cacheKeys.remove(key); (<--!--) releaseKey(cacheKey); } }
In my case, the marked line is called, in there the given key is found and the holding node gets removed from cacheKeys and freed,. So, my cacheKey is freed also, what makes the call of next method
releaseKey
throw.I did comment out the line marked above, recompiled that module, now it works.
Is this a problem on my side or a bug?Hope you are able to understand my humble english...
Regards and thanks for help,
F. Wambach
-
@Wambach said in QPixmapCache insert behaviour when insert fails:
I do load a resource PNG file (3000x1781px ARGB) and QT tries to save it in PixmapCache, more exactly in QPMCache module. The method insert is called, but returns false as the size (21.7M is bigger than some ‘mx’)
If I understood correctly your problem comes from rcc, can it be this? https://forum.qt.io/topic/71838/large-number-of-png-resources-qrc_resources-cpp-segmentation-fault-11/3
-
If I understood correctly your problem comes from rcc, can it be this? https://forum.qt.io/topic/71838/large-number-of-png-resources-qrc_resources-cpp-segmentation-fault-11/3
yes, that's true, it an image loaded from qrc.
Anyway, as size does not matter yet, we did include the resources file (the png file is about 270kB, though, and expands to RGBA-fullsize bitmap of some 20MB only internally for QPixmapCache).
Beside that, I did ancounter given problem, and could overcome that only by disabling the code line.
So, still the question is: Is that a bug?Regards,
Wambach
-
Hi,
Looks similar to QTBUG-59065 which is a duplicate of QTBUG-58259.