comp.lang.ada
 help / color / mirror / Atom feed
From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: I've not seen this error before
Date: Wed, 01 Apr 2015 16:58:40 +0300
Date: 2015-04-01T16:58:40+03:00	[thread overview]
Message-ID: <co2bsfFlkukU1@mid.individual.net> (raw)
In-Reply-To: <0c11feff-2478-4cdc-b9ee-4404f1c35dc1@googlegroups.com>

On 15-04-01 16:18 , tonyg wrote:
> I don't have any controlled types. I've never worked out how to use
> them :)

Your Device_Details_Type record has the component

    Name : SU.Unbounded_String;

Assuming "SU" is a renaming for Ada.Strings.Unbounded, then the record 
has a component of a type that needs finalization, namely 
Ada.Strings.Unbounded.Unbounded_String, and this type probably involves 
controlled types.

> This all seemed to happen when I started storing records in files.So
> I've now got a task which loads the file at the start then looks at a
> queue then sticks those changes back in the file.

Do you store also the Name component in the file? Directly as type 
Unbounded_String, or converted to some non-controlled type? An 
Unbounded_String almost certainly contain an access component to some 
heap-allocated text buffer. That access value is most likely no longer 
valid if you write it out from one run of the program and read it back 
in another run. Even if you read and write in the same run, the access 
value may have become invalid, because that heap block may have been 
released in between writing and reading.

It may help to change to Bounded_String (the ARM says these "should not" 
involve implicit pointers and dynamic allocation) but it would be safest 
to store the Name as a fixed-length String.

-- 
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
       .      @       .


  reply	other threads:[~2015-04-01 13:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-01  8:42 I've not seen this error before tonyg
2015-04-01 13:08 ` Simon Wright
2015-04-01 13:18   ` tonyg
2015-04-01 13:58     ` Niklas Holsti [this message]
2015-04-01 14:32       ` tonyg
2015-04-02  5:33   ` Randy Brukardt
replies disabled

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