<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="12" style="border: 1px #c9c399 solid; border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
<tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="https://git.reviewboard.kde.org/r/127795/">https://git.reviewboard.kde.org/r/127795/</a>
</td>
</tr>
</table>
<br />
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Note first off that I'm not a Plasma dev, so some of these comments are questions more than they are statements. I do see several issues though:</p>
<ul style="padding: 0;text-rendering: inherit;margin: 0 0 0 1em;line-height: inherit;white-space: normal;">
<li style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;">It seems to me that there's a lot of changes in here which aren't actually necessary to fix the bug you're talking about.</li>
<li style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;">The bug description is extremely sparse. There is presumably a memory leak... how did you notice it? How did you isolate it? Did you find a particular bug and then fix that, or did you make changes here and there until you couldn't reproduce the bug anymore? We prefer bug fixes where the bug <em style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;">and</em> the solution are well-understood. ;) But we rely on good descriptions of what the bug is and how it's now fixed (instead of 'see title').</li>
<li style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;">I believe the Plasma developers are on a separate group; you should edit the review request to add the 'plasma' group to ensure this is reviewed by developers with actual Plasma experience.</li>
</ul>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">With all that said I do believe you've found at least one leak and closed it off, but it's hard to tell that from the patch and minimal description that's been submitted.</p></pre>
<br />
<div>
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
<thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
<a href="https://git.reviewboard.kde.org/r/127795/diff/1/?file=461949#file461949line85" style="color: black; font-weight: bold; text-decoration: underline;">autotests/pluginloadertest.cpp</a>
<span style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
<th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">84</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="n">QVERIFY</span><span class="p">(</span><span class="n">engine</span> <span class="o">!=</span> <span class="mi">0</span> <span class="o">&&</span> <span class="n">engine</span><span class="o">-></span><span class="n">isValid</span><span class="p">());</span></pre></td>
</tr>
</tbody>
</table>
<div style="margin-left: 2em;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">`engine != 0` can simply be `engine` in this bool context. Plus you should really prefer `Q_NULLPTR` to `0` in modern code anyways even if you wanted to check directly.</pre>
</div>
</div>
<br />
<div>
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
<thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
<a href="https://git.reviewboard.kde.org/r/127795/diff/1/?file=461950#file461950line162" style="color: black; font-weight: bold; text-decoration: underline;">src/plasma/datacontainer.cpp</a>
<span style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">162</font></th>
<td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="k">this</span><span class="p">,</span> <span class="n">SLOT</span><span class="p">(</span><span class="n">disconnectVisualization</span><span class="p">(</span><span class="n">QObject</span><span class="o">*</span><span class="p">))<span class="hl">);</span></span><span class="hl"> </span><span class="c1"><span class="hl">//</span>, Qt::<span class="hl">Queued</span>Connection);</span></pre></td>
<th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">162</font></th>
<td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="k">this</span><span class="p">,</span> <span class="n">SLOT</span><span class="p">(</span><span class="n">disconnectVisualization</span><span class="p">(</span><span class="n">QObject</span><span class="o">*</span><span class="p">)),</span> <span class="n">Qt</span><span class="o">::</span><span class="n"><span class="hl">Unique</span>Connection</span><span class="p">);</span></pre></td>
</tr>
</tbody>
</table>
<div style="margin-left: 2em;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Although I've made a lot of questions regarding usage of Qt::UniqueConnection elsewhere, this one may be necessary since I don't see any other checks for whether this signal-slot connection already exists.</pre>
</div>
</div>
<br />
<div>
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
<thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
<a href="https://git.reviewboard.kde.org/r/127795/diff/1/?file=461950#file461950line170" style="color: black; font-weight: bold; text-decoration: underline;">src/plasma/datacontainer.cpp</a>
<span style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">170</font></th>
<td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="n">visualization</span><span class="p">,</span> <span class="n">SLOT</span><span class="p">(</span><span class="n">dataUpdated</span><span class="p">(</span><span class="n">QString</span><span class="p">,</span><span class="n">Plasma</span><span class="o">::</span><span class="n">DataEngine</span><span class="o">::</span><span class="n">Data</span><span class="p">)));</span></pre></td>
<th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">170</font></th>
<td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="n">visualization</span><span class="p">,</span> <span class="n">SLOT</span><span class="p">(</span><span class="n">dataUpdated</span><span class="p">(</span><span class="n">QString</span><span class="p">,</span><span class="n">Plasma</span><span class="o">::</span><span class="n">DataEngine</span><span class="o">::</span><span class="n">Data</span><span class="p">))<span class="hl">,</span></span><span class="hl"> </span><span class="n"><span class="hl">Qt</span></span><span class="o"><span class="hl">::</span></span><span class="n"><span class="hl">UniqueConnection</span></span><span class="p">);</span></pre></td>
</tr>
</tbody>
</table>
<div style="margin-left: 2em;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">This and the next 3 Qt::UniqueConnection flags appear to be unneeded: by this point in the code path there have already been checks for these signal-slot connections and what appear to be correct calls to QObject::disconnect().</pre>
</div>
</div>
<br />
<div>
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
<thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
<a href="https://git.reviewboard.kde.org/r/127795/diff/1/?file=461951#file461951line269" style="color: black; font-weight: bold; text-decoration: underline;">src/plasma/dataengine.cpp</a>
<span style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">269</font></th>
<td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="k">this</span><span class="p">,</span> <span class="n">SLOT</span><span class="p">(</span><span class="n">internalUpdateSource</span><span class="p">(</span><span class="n">DataContainer</span><span class="o">*</span><span class="p">)));</span></pre></td>
<th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">269</font></th>
<td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="k">this</span><span class="p">,</span> <span class="n">SLOT</span><span class="p">(</span><span class="n">internalUpdateSource</span><span class="p">(</span><span class="n">DataContainer</span><span class="o">*</span><span class="p">))<span class="hl">,</span></span><span class="hl"> </span><span class="n"><span class="hl">Qt</span></span><span class="o"><span class="hl">::</span></span><span class="n"><span class="hl">UniqueConnection</span></span><span class="p">);</span></pre></td>
</tr>
</tbody>
</table>
<div style="margin-left: 2em;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Although for this instance of Qt::UniqueConnection, I can't prove it impossible that duplicates would occur, this code path does have a guard to avoid duplicate sources being created for this data engine. Are we sure these Qt::UniqueConnection flags are necessary, or is this experimentation?
On that note, it might be a good idea to combine this code path with common portions DataEnginePrivate::source(QString,bool) in order to ensure there's one (and only one) correct way to add a source to a data engine. That would help for later code audits when trying to verify where (and when) QObject connections are created.</pre>
</div>
</div>
<br />
<div>
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
<thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
<a href="https://git.reviewboard.kde.org/r/127795/diff/1/?file=461951#file461951line416" style="color: black; font-weight: bold; text-decoration: underline;">src/plasma/dataengine.cpp</a>
<span style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">415</font></th>
<td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="n">refCount</span><span class="p">(</span><span class="o"><span class="hl">-</span></span><span class="mi"><span class="hl">1</span></span><span class="p">),</span> <span class="c1">// first ref</span></pre></td>
<th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">416</font></th>
<td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="n">refCount</span><span class="p">(</span><span class="mi"><span class="hl">0</span></span><span class="p">),</span> <span class="c1">// first ref</span></pre></td>
</tr>
</tbody>
</table>
<div style="margin-left: 2em;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">This should be 1 instead of 0 given the changes you've made elsewhere (unless the existing value is a bug...).
But, the entire set of changes to reference count handling appear to be unnecessary. Why the change?</pre>
</div>
</div>
<br />
<div>
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
<thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
<a href="https://git.reviewboard.kde.org/r/127795/diff/1/?file=461951#file461951line521" style="color: black; font-weight: bold; text-decoration: underline;">src/plasma/dataengine.cpp</a>
<span style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">520</font></th>
<td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="n">QObject</span><span class="o">::</span><span class="n">connect</span><span class="p">(</span><span class="n">s</span><span class="p">,</span> <span class="n">SIGNAL</span><span class="p">(</span><span class="n">destroyed</span><span class="p">(</span><span class="n">QObject</span><span class="o">*</span><span class="p">)),</span> <span class="n">q</span><span class="p">,</span> <span class="n">SLOT</span><span class="p">(</span><span class="n">sourceDestroyed</span><span class="p">(</span><span class="n">QObject</span><span class="o">*</span><span class="p">)));</span></pre></td>
<th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">521</font></th>
<td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="n">QObject</span><span class="o">::</span><span class="n">connect</span><span class="p">(</span><span class="n">s</span><span class="p">,</span> <span class="n">SIGNAL</span><span class="p">(</span><span class="n">destroyed</span><span class="p">(</span><span class="n">QObject</span><span class="o">*</span><span class="p">)),</span> <span class="n">q</span><span class="p">,</span> <span class="n">SLOT</span><span class="p">(</span><span class="n">sourceDestroyed</span><span class="p">(</span><span class="n">QObject</span><span class="o">*</span><span class="p">))<span class="hl">,</span></span><span class="hl"> </span><span class="n"><span class="hl">Qt</span></span><span class="o"><span class="hl">::</span></span><span class="n"><span class="hl">UniqueConnection</span></span><span class="p">);</span></pre></td>
</tr>
</tbody>
</table>
<div style="margin-left: 2em;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">The DataContainer <code style="text-rendering: inherit;color: #4444cc;padding: 0;white-space: normal;margin: 0;line-height: inherit;">s</code> has only just been created by this point in the code, so <code style="text-rendering: inherit;color: #4444cc;padding: 0;white-space: normal;margin: 0;line-height: inherit;">Qt::UniqueConnection</code> should be meaningless. Likewise for the change 2 lines down.</p></pre>
</div>
</div>
<br />
<div>
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
<thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
<a href="https://git.reviewboard.kde.org/r/127795/diff/1/?file=461951#file461951line606" style="color: black; font-weight: bold; text-decoration: underline;">src/plasma/dataengine.cpp</a>
<span style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
<th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">606</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="n">q</span><span class="p">,</span> <span class="n">SLOT</span><span class="p">(</span><span class="n">removeSource</span><span class="p">(</span><span class="n">QString</span><span class="p">)),</span> <span class="n">Qt</span><span class="o">::</span><span class="n">UniqueConnection</span><span class="p">);</span></pre></td>
</tr>
</tbody>
</table>
<div style="margin-left: 2em;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">By definition the source here has been created for the first time in this code path. So Qt::UniqueConnection should be useless.</pre>
</div>
</div>
<br />
<div>
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
<thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
<a href="https://git.reviewboard.kde.org/r/127795/diff/1/?file=461952#file461952line49" style="color: black; font-weight: bold; text-decoration: underline;">src/plasma/private/dataenginemanager.cpp</a>
<span style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody>
<tr>
<th bgcolor="#ebb1ba" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">49</font></th>
<td bgcolor="#ffc5ce" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="n">d</span><span class="o">-></span><span class="n">ref</span><span class="p">();</span></pre></td>
<th bgcolor="#ebb1ba" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
<td bgcolor="#ffc5ce" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
</tr>
</tbody>
</table>
<div style="margin-left: 2em;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Is it safe to remove this, given that even the change to DataEngineManager::loadEngine to ->ref all returned engines still doesn't ->ref the null engine?</pre>
</div>
</div>
<br />
<p>- Michael Pyne</p>
<br />
<p>On April 30th, 2016, 3:18 p.m. UTC, Anthony Fieroni wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="12" style="border: 1px #888a85 solid; border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
<tr>
<td>
<div>Review request for KDE Frameworks and Marco Martin.</div>
<div>By Anthony Fieroni.</div>
<p style="color: grey;"><i>Updated April 30, 2016, 3:18 p.m.</i></p>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt;">Repository: </b>
plasma-framework
</div>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">^^</p></pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Test pass.</p></pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>autotests/pluginloadertest.h <span style="color: grey">(61fc963)</span></li>
<li>autotests/pluginloadertest.cpp <span style="color: grey">(4f96780)</span></li>
<li>src/plasma/datacontainer.cpp <span style="color: grey">(ee067db)</span></li>
<li>src/plasma/dataengine.cpp <span style="color: grey">(f942926)</span></li>
<li>src/plasma/private/dataenginemanager.cpp <span style="color: grey">(08e42fb)</span></li>
</ul>
<p><a href="https://git.reviewboard.kde.org/r/127795/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>