<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta http-equiv="Content-Style-Type" content="text/css" />
  <meta name="generator" content="pandoc" />
  <title></title>
  <style type="text/css">code{white-space: pre;}</style>
</head>
<body>
<p>Hi Hugo,</p>
<p>On 2017-03-01 09:57, Hugo Beauzée-Luyssen wrote:</p>
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;color:#500050">
<pre><code> On Wed, Mar 1, 2017, at 09:52 AM, Filip Roséen wrote:</code></pre>
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;color:#500050">
<pre><code> 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.

 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</code></pre>
</blockquote>
<pre><code> I guess using qDeleteAll would be easier. LGTM otherwise</code></pre>
</blockquote>
<p>Ah yeah, that’s a very good point; I did not even consider <code>QHash::values</code>at the time when I wrote the patch, that together with <code>qDeleteAll</code> is of course cleaner than what is proposed.</p>
<p>I will also take the opportunity to remove the call to <code>cache.clear()</code> as it does not matter since we are destroying the object which has <code>cache</code> as a member.</p>
<p>Thanks,<br />
Filip</p>
</body>
</html>