[vlc-devel] [PATCH] gui/qt: pictureflow: clear cache on destruction
Filip Roséen
filip at atch.se
Wed Mar 1 09:52:03 CET 2017
PictureFlowRenderer::cache is used to store QImage's for later use,
though given that no clean-up was previously implemented we would leak
all QImage's inside the container.
--
Indirect leak of 8 byte(s) in 1 object(s) allocated from:
#0 0x7f9887fb3e80 in operator new(unsigned long) /build/gcc-multilib/src/gcc/libsanitizer/asan/asan_new_delete.cc:60
#1 0x7f9864f77f82 in QRasterPaintEngine::init() (/usr/lib/libQt5Gui.so.5+0x33ff82)
#2 0x7f9864d712d7 in QImage::paintEngine() const (/usr/lib/libQt5Gui.so.5+0x1392d7)
#3 0x7f9864f91655 in QPainter::begin(QPaintDevice*) (/usr/lib/libQt5Gui.so.5+0x359655)
#4 0x7f98660f97f9 in prepareSurface /home/refp/work/videolan/vlc/git/modules/gui/qt/util/pictureflow.cpp:351
#5 0x7f9866104e66 in PictureFlowSoftwareRenderer::surface(QModelIndex) /home/refp/work/videolan/vlc/git/modules/gui/qt/util/pictureflow.cpp:478
#6 0x7f9866105954 in PictureFlowSoftwareRenderer::renderSlide(SlideInfo const&, int, int) /home/refp/work/videolan/vlc/git/modules/gui/qt/util/pictureflow.cpp:513
#7 0x7f9866107937 in PictureFlowSoftwareRenderer::renderSlides() /home/refp/work/videolan/vlc/git/modules/gui/qt/util/pictureflow.cpp:619
#8 0x7f9866107b79 in PictureFlowSoftwareRenderer::render() /home/refp/work/videolan/vlc/git/modules/gui/qt/util/pictureflow.cpp:628
#9 0x7f9866107f7b in PictureFlowSoftwareRenderer::paint() /home/refp/work/videolan/vlc/git/modules/gui/qt/util/pictureflow.cpp:281
#10 0x7f98660fc90a in PictureFlow::paintEvent(QPaintEvent*) /home/refp/work/videolan/vlc/git/modules/gui/qt/util/pictureflow.cpp:855
#11 0x7f9865711cd7 in QWidget::event(QEvent*) (/usr/lib/libQt5Widgets.so.5+0x19acd7)
#12 0x7f98656ca34b in QApplicationPrivate::notify_helper(QObject*, QEvent*) (/usr/lib/libQt5Widgets.so.5+0x15334b)
#13 0x7f98656d1b60 in QApplication::notify(QObject*, QEvent*) (/usr/lib/libQt5Widgets.so.5+0x15ab60)
#14 0x7f98647e443f in QCoreApplication::notifyInternal2(QObject*, QEvent*) (/usr/lib/libQt5Core.so.5+0x28843f
---
modules/gui/qt/util/pictureflow.cpp | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/modules/gui/qt/util/pictureflow.cpp b/modules/gui/qt/util/pictureflow.cpp
index a76a4accb1..551127c2ef 100644
--- a/modules/gui/qt/util/pictureflow.cpp
+++ b/modules/gui/qt/util/pictureflow.cpp
@@ -257,6 +257,13 @@ PictureFlowSoftwareRenderer::PictureFlowSoftwareRenderer():
PictureFlowSoftwareRenderer::~PictureFlowSoftwareRenderer()
{
buffer = QImage();
+
+ for( QHash<QString, QImage*>::const_iterator
+ it = cache.constBegin(); it != cache.constEnd(); ++it )
+ {
+ delete it.value();
+ }
+
cache.clear();
delete blankSurface;
}
--
2.12.0
More information about the vlc-devel
mailing list