Details
-
Bug
-
Resolution: Invalid
-
P2: Important
-
None
-
5.9.2, 5.9.4, 5.11.1
-
Please see the attached qtdiag_info.txt file
Description
In 2D renderer mode, the function createTextureFromImage(const QImage &image) creates one extra instance of QImage and keeps it unreleased.
It creates the issue for us as in our application we use the ability of QImage to create multiple instances of QImage from the same buffer: QImage(uchar *data, int width, int height, Format format, QImageCleanupFunction cleanupFunction = Q_NULLPTR, void *cleanupInfo = Q_NULLPTR) and possibility to count the number of instances by using the cleanup function.
Steps to reproduce:
1. Run the attached code example.
2 Observe the debug output of the application:
the current output for 2D renderer:
updatePaintNode(), frame# 0 ++refCount = 1 updatePaintNode(), frame# 1 ++refCount = 2 --refCount = 1 updatePaintNode(), frame# 2 ++refCount = 2 --refCount = 1 updatePaintNode(), frame# 3 ++refCount = 2 --refCount = 1 Expected output, and the output with OpenGl renderer: updatePaintNode(), frame# 0 ++refCount = 1 --refCount = 0 updatePaintNode(), frame# 1 ++refCount = 1 --refCount = 0 updatePaintNode(), frame# 2 ++refCount = 1 --refCount = 0 updatePaintNode(), frame# 3 ++refCount = 1 --refCount = 0
As you can see one in 2D renderer mode one extra copy of the the image is created and not released for a long time. I noticed that this image is sometimes is been released spontaneously after several seconds if some CPU idling is added. Reproduced on macOS high Sierra and Windows 10