Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.12.2
-
None
-
b8a911fbebfcd297ce08b91fbe85bb1624d257d9 (qt/qtbase/5.13)
Description
QPainter::end() leaks memory, if the warning the "QPainter::end: Painter ended with %d saved states" occurs. That is, memory is leaked, if for example save() is called without calling restore() before end of painting.
The attached example code qpainter_mem_leak.cpp reproduces the problem which was also verified with valgrind:
valgrind --tool=memcheck --leak-check=full --track-origins=yes qpainter_mem_leak:
==24569== 2,680 (2,048 direct, 632 indirect) bytes in 2 blocks are definitely lost in loss record 3,880 of 3,913 |
==24569== at 0x4C28203: operator new(unsigned long) (vg_replace_malloc.c:334) |
==24569== by 0x9389CD9: QRasterPaintEngine::createState(QPainterState*) const (in [...]/lib/libQt5Gui.so.5.12.2) |
==24569== by 0x93A6244: QPainter::begin(QPaintDevice*) (in [...]/lib/libQt5Gui.so.5.12.2) |