comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Strange factory for wxAda
Date: Tue, 18 Oct 2005 16:53:53 -0500
Date: 2005-10-18T16:53:53-05:00	[thread overview]
Message-ID: <SbudnctNQq9i8MjeRVn-jA@megapath.net> (raw)
In-Reply-To: 1129652902.862979.44810@f14g2000cwb.googlegroups.com

"Lucretia" <lucretia9@lycos.co.uk> wrote in message
news:1129652902.862979.44810@f14g2000cwb.googlegroups.com...
>
> Randy Brukardt wrote:
> > "Lucretia" <lucretia9@lycos.co.uk> wrote in message
> > news:1129564741.462159.308620@g47g2000cwa.googlegroups.com...
...
> > 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).
>
> At the moment, I'm not even thinking about tasking, this will have to
> be thought about later, when I turn my event handler into some sort of
> protected object, which will be tricky considering that that is called
> from C++ :-/

Careful. You really need to think about tasking early on, because it is
extremely hard to graft it on afterwards. Now, you may decide that it simply
isn't worth it, and decide to restrict the uses to one task (as GWindows
does, for instance), but it's best to decide on the approach right away.

> > > 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).
>
> Well, all objects are derived from a root Limited_Cotnrolled tagged
> type, if that's what you mean? So, I can copy the access types, but not
> the instances. Unless you mean create a "smart pointer" type to
> encapsulate the wxAda *_Type'Access types with?

That's what I meant. If you want to do the allocation yourself, you really
don't want any dangling references. So you might want to do whatever it
takes to avoid them (that means making the type limited and not using any
access types in your client interface).

In any case, this seems like a tough problem, which I'm glad I don't need to
solve. :-)

                       Randy.







  reply	other threads:[~2005-10-18 21:53 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
2005-10-18 16:28   ` Lucretia
2005-10-18 21:53     ` Randy Brukardt [this message]
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