<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/129099/">https://git.reviewboard.kde.org/r/129099/</a>
</td>
</tr>
</table>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<p style="margin-top: 0;">On October 4th, 2016, 9 p.m. UTC, <b>Albert Astals Cid</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<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;">I honestly don't see the benefit</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">You changed a delete by a reset, is there any benefit at all other than making the code harder to read?</p></pre>
</blockquote>
<p>On October 4th, 2016, 9:07 p.m. UTC, <b>Oliver Sander</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<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;">I see three benefits:
a) I can see by looking at the declaration of m_drawingEngine that it has ownership semantics. IMO that's quite helpful when trying to understand new code.
b) I don't have to call 'delete' (admittedly that's minor here, because m_drawingEngine is deleted only once).
c) Have a look at https://git.reviewboard.kde.org/r/128858 . There I had to introduce</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;"><div class="codehilite" style="background: #f8f8f8"><pre style="line-height: 125%"> delete m_drawingEngine;
m_drawingEngine = new SmoothPathEngine( m_currentDrawingToolElement );
</pre></div>
</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">With a unique_ptr this is simply</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;"><div class="codehilite" style="background: #f8f8f8"><pre style="line-height: 125%"> <span style="color: #008000; font-weight: bold">m_drawingEngine</span> <span style="color: #666666">=</span> <span style="color: #008000; font-weight: bold">std</span><span style="color: #666666">:</span><span style="color: #AA22FF">:make_unique</span><span style="color: #666666"><</span><span style="color: #008000; font-weight: bold">SmoothPathEngine</span><span style="color: #666666">>(</span> <span style="color: #008000; font-weight: bold">m_currentDrawingToolElement</span> <span style="color: #666666">);</span>
</pre></div>
</p></pre>
</blockquote>
<p>On October 5th, 2016, 8:56 a.m. UTC, <b>Oliver Sander</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<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;">Alternatively, the last line could be</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">m_drawingEngine.reset( new SmoothPathEngine( m_currentDrawingToolElement ) );</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">which makes the intention even clearer.</p></pre>
</blockquote>
</blockquote>
<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 code doesn't certainly seems clearer to me, but probably i'm just old. I'll let others that are actually developing the frameworks branch decide.</p></pre>
<br />
<p>- Albert</p>
<br />
<p>On October 4th, 2016, 8:33 p.m. UTC, Oliver Sander 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 Okular.</div>
<div>By Oliver Sander.</div>
<p style="color: grey;"><i>Updated Oct. 4, 2016, 8:33 p.m.</i></p>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt;">Repository: </b>
okular
</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;">Because it has ownership semantics.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">The code would be even shorter with std::make_unique, but that is C++14. Is that allowed in Okular?</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>ui/presentationwidget.h <span style="color: grey">(69574d2)</span></li>
<li>ui/presentationwidget.cpp <span style="color: grey">(c16d616)</span></li>
</ul>
<p><a href="https://git.reviewboard.kde.org/r/129099/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>