<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[[Solved] Should call destructor after QList&lt;CustomObjectPointer *&gt; when call &quot;remove&quot; methods?]]></title><description><![CDATA[<p dir="auto">If we have a QList managing pointers to custom objects class, when we call remove methods:</p>
<p dir="auto">@<br />
QList &lt;CustomClass <em>&gt; lines; //Declaration.<br />
/</em>******************/<br />
//Call to remove:<br />
lines.removeLast();<br />
@</p>
<p dir="auto">Should I call delete(object Im going to remove) before call lines.removeLast(), or It's called automatically when removeLast() is invoked?</p>
<p dir="auto">Ty</p>
<p dir="auto">-----------------------EDIT------------------------</p>
<p dir="auto">Yes, It's necessary. Otherwise, parent item will still drawing it, if it's a customized QGraphicsItem.</p>
]]></description><link>https://forum.qt.io/topic/29870/solved-should-call-destructor-after-qlist-customobjectpointer-when-call-remove-methods</link><generator>RSS for Node</generator><lastBuildDate>Thu, 03 Sep 2026 08:39:23 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/29870.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 24 Jul 2013 18:48:53 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to [Solved] Should call destructor after QList&lt;CustomObjectPointer *&gt; when call &quot;remove&quot; methods? on Thu, 25 Jul 2013 10:01:50 GMT]]></title><description><![CDATA[<p dir="auto">Ty 1 +1 for your fast reply.</p>
<p dir="auto">Your suggestion is much cleaner than mine, thank you =)</p>
]]></description><link>https://forum.qt.io/post/187785</link><guid isPermaLink="true">https://forum.qt.io/post/187785</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Thu, 25 Jul 2013 10:01:50 GMT</pubDate></item><item><title><![CDATA[Reply to [Solved] Should call destructor after QList&lt;CustomObjectPointer *&gt; when call &quot;remove&quot; methods? on Thu, 25 Jul 2013 02:05:34 GMT]]></title><description><![CDATA[<p dir="auto">Hi, seems takeLast is more suitable for you.<br />
@<br />
delete lines.takeLast();<br />
@</p>
]]></description><link>https://forum.qt.io/post/187730</link><guid isPermaLink="true">https://forum.qt.io/post/187730</guid><dc:creator><![CDATA[dbzhang800]]></dc:creator><pubDate>Thu, 25 Jul 2013 02:05:34 GMT</pubDate></item></channel></rss>