comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Strange factory for wxAda
Date: Mon, 17 Oct 2005 19:36:57 -0500
Date: 2005-10-17T19:36:57-05:00	[thread overview]
Message-ID: <zoSdnVCl7e8q38neRVn-qQ@megapath.net> (raw)
In-Reply-To: 1129564741.462159.308620@g47g2000cwa.googlegroups.com

"Lucretia" <lucretia9@lycos.co.uk> 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.







  reply	other threads:[~2005-10-18  0:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-17 15:59 Strange factory for wxAda Lucretia
2005-10-18  0:36 ` Randy Brukardt [this message]
2005-10-18 16:28   ` Lucretia
2005-10-18 21:53     ` Randy Brukardt
2005-10-24 13:09       ` Lucretia
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox