From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,591cf01fd1138c66 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.megapath.net!news.megapath.net.POSTED!not-for-mail NNTP-Posting-Date: Mon, 17 Oct 2005 19:32:55 -0500 From: "Randy Brukardt" Newsgroups: comp.lang.ada References: <1129564741.462159.308620@g47g2000cwa.googlegroups.com> Subject: Re: Strange factory for wxAda Date: Mon, 17 Oct 2005 19:36:57 -0500 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4952.2800 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4952.2800 Message-ID: NNTP-Posting-Host: 64.32.209.38 X-Trace: sv3-YIP2YaZf9lscUiMLVbueIH2Jaz31rRNcz3xhS/uBsgZCEcQ/n3Cmy2CRJrGIEpz7L8SVsiZ/46yJe8a!fMis6aSpfy56k908mhkO5Bk7e979Hhg1pjIIMDEMSobJNooZm5t8OJBAkJObdkRiS00gwdQOq9Rv X-Complaints-To: abuse@megapath.net X-DMCA-Complaints-To: abuse@megapath.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32 Xref: g2news1.google.com comp.lang.ada:5764 Date: 2005-10-17T19:36:57-05:00 List-Id: "Lucretia" wrote in message news:1129564741.462159.308620@g47g2000cwa.googlegroups.com... I'm not sure what I'd recommend in this case. ... > When the event handler has been called and the event handled, should I: > > 1) call Finalize on the pointer explicitly (I've seen CLAW do this)? > But I didn't realise that you could call Finalize explicitly. Certainly, you can -- it's just a procedure, after all. You do need to be careful that it can be called multiple times on the same object without incident, but you ought to do that anyway (it can be called multiple times in some Abort scenarios, so it's best to protected against that). > 2) call an Unchecked_Deallocation on this pointer? If your library is allocating the object, then its OK for your library to deallocate it. (And that will call Finalize, of course). But you should never deallocate something that your user(s) allocated. And you may need to reference count the object (if the pointers can be copied), or better, give the pointers a limited type (they'll have to be a record in that case, wrapping the pointer). Randy.