<div dir="ltr"><div class="gmail_extra"><div class="gmail_default" style="font-family:trebuchet ms,sans-serif"><span style="font-family:arial,helvetica,sans-serif">​Hi Sven,</span>​</div><br><div class="gmail_quote">On Sat, Sep 27, 2014 at 7:33 PM, Sven Barth <span dir="ltr"><<a href="mailto:pascaldragon@googlemail.com" target="_blank">pascaldragon@googlemail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div id=":236" class="" style="overflow:hidden">Huh? Delphi really prohibits such things inside the destructor? Would you mind to share an example (possibly including error messages), please?<span class=""><br></span></div></blockquote><div><br><div class="gmail_default" style="display:inline"><span style="font-family:arial,helvetica,sans-serif">​Sorry, I wasn't clear enough. ​</span></div><span style="font-family:arial,helvetica,sans-serif">​With ​"prohibits" I didn't mean that you get a compiler error. It compiles and runs just fine but you get a stack overflow at runtime</span><div class="gmail_default" style="display:inline"><span style="font-family:arial,helvetica,sans-serif">​ when the dest​</span></div><div class="gmail_default" style="display:inline"><span style="font-family:arial,helvetica,sans-serif">​ructor is called​</span></div><span style="font-family:arial,helvetica,sans-serif">. <br></span><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class=""></span>I've done a different approach already: the decrease helper sets refcount to -1 directly before it calls the destructor and both the increase and the decrease helper check for -1. Considering that it's currently only a proof of concept I can live with the performance impact that comparison might have.</blockquote></div><br><div class="gmail_default" style="font-family:trebuchet ms,sans-serif"><span style="font-family:arial,helvetica,sans-serif">​OK, but keep my proposal in mind since it has overhead only at BeforeDestruction which is once per instance lifecycle.</span><br><br></div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif"><span style="font-family:arial,helvetica,sans-serif">--Constantine</span><br></div></div></div>