<div dir="ltr"><div><div><div><div>It depends on your use case but maybe you can simply create a QObject that has the responsability of deleting your QObjects and  emit a signal just after calling deleteLater.<br><br></div>class MyDeleter : public QObject<br>{<br>...<br></div><div>signals:<br></div><div>    void aboutToBeDelete(QObject*);<br></div><div>...<br></div>void invokeDeleteLater(QObject* other) {<br></div>    other->deleteLater();<br></div>    emit aboutToBeDeleted(other)<br><div><div><div>}<br><div>...<br>}<br><br></div><div>Depending on your architecture you can make it a singleton, global or context variable.<br></div><div>After that you can replace everywhere:<br>objectManagedByCache->deleteLater() <br>with<br></div><div>myDeleter->invokeDeleteLater(objectManagedByCache).<br><br></div><div>You can also add this "invokeDeleteLater" directly to the class that manages your cache.<br><br></div><div><br></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-05-05 21:09 GMT+02:00 Sean Donnelly <span dir="ltr"><<a href="mailto:Sean.Donnelly@autodesk.com" target="_blank">Sean.Donnelly@autodesk.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div link="#0563C1" vlink="#954F72" lang="EN-US">
<div>
<p class="MsoNormal">In our application we maintain a UI Inventory via a named object cache.  When an object is destroyed we remove it from our cache and when the name is changed we also update our cache.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">However when an object is scheduled for deletion via QObject::deleteLater() the object remains in our cache until it’s actually deleted.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I have two proposals:<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p><u></u><span>1.<span style="font:7.0pt "Times New Roman"">      
</span></span><u></u>Could deleteLater() send a signal so that we can update our cache immediately and not find that UI object which is about to be deleted.<u></u><u></u></p>
<p><u></u><span>2.<span style="font:7.0pt "Times New Roman"">      
</span></span><u></u>Could deleteLater() set a property to know the object is in an “about to be deleted state”. That way our UI Inventory could be updated to ignore these objects.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Thanks,<u></u><u></u></p>
<p class="MsoNormal">Sean<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>

<br>_______________________________________________<br>
Development mailing list<br>
<a href="mailto:Development@qt-project.org">Development@qt-project.org</a><br>
<a href="http://lists.qt-project.org/mailman/listinfo/development" rel="noreferrer" target="_blank">http://lists.qt-project.org/mailman/listinfo/development</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature">Filippo Cucchetto</div>
</div>