comp.lang.ada
 help / color / mirror / Atom feed
From: "chris.danx" <spamoff.danx@ntlworld.com>
Subject: Re: have to use unrestricted access but just what about access
Date: Thu, 20 Jun 2002 18:11:38 +0100
Date: 2002-06-20T18:11:38+01:00	[thread overview]
Message-ID: <H1oQ8.19314$AZ6.2599533@news6-win.server.ntlworld.com> (raw)
In-Reply-To: 5ee5b646.0206200805.7c4be786@posting.google.com


"Robert Dewar" <dewar@gnat.com> wrote in message
news:5ee5b646.0206200805.7c4be786@posting.google.com...


> The referenced post in this thread is an excellent lesson
> in when how to seriously misuse the Unrestricted_Access
> attribute.

I wasn't comfortable with Unrestriced_Access anyway, so the code was changed
it earlier today not to use Unrestricted_Access...

   type Dot_Window
      is new Gwindows.Windows.Main.Main_Window_Type
     with record
        Drawing_Surface : Gwindows.Drawing_Panels.Drawing_Panel_Access :=
null;

        Key_Coordinator : Dot_Key_Coor.Coordinator_Access := null;
        Watcher         : Dot_Key_Watcher.Watcher_Access  := null;
        Builder         : Dot_Builder.Builder_Access      := null;
     end record;

Everything is dynamically allocated and if at any point an allocation fails,
the program is terminated (after tidying up of course)!

If you have a suggestion as to how to improve the mechanism by which the two
tasks communicate I'd gladly listen.

> But even a cursory examination of this code will show
> that it is very likely to generate a dangling pointer.

The tasks which use the protected object are terminated (and deallocated)
before the protected object itself, so there should be no dangling pointer.
I always make a point of noting where anything is allocated and under what
circumstances they should be deallocated.





      reply	other threads:[~2002-06-20 17:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-19 23:32 have to use unrestricted access but just what about access chris.danx
2002-06-20  8:41 ` chris.danx
2002-06-20 12:10 ` SteveD
2002-06-20 14:22 ` Robert A Duff
2002-06-21 11:45   ` Robert Dewar
2002-06-22  0:49     ` Robert A Duff
2002-06-22  1:05       ` Ted Dennison
2002-06-22 12:09         ` Robert Dewar
2002-07-20  4:59     ` Craig Carey
2002-07-20 17:47       ` Robert A Duff
2002-07-21  8:45         ` Craig Carey
2002-06-20 16:05 ` Robert Dewar
2002-06-20 17:11   ` chris.danx [this message]
replies disabled

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