+2014-07-16 Ed Schonberg <schonberg@adacore.com>
+
+ * a-coinho-shared.adb, a-coinho-shared.ads: Proper structures for
+ tampering checks.
+
2014-07-16 Ed Schonberg <schonberg@adacore.com>
* a-coinho-shared.adb: Fix spurious accessibility check.
overriding procedure Adjust (Control : in out Reference_Control_Type) is
begin
if Control.Container /= null then
- Reference (Control.Container);
+ Reference (Control.Container.Reference);
+ declare
+ B : Natural renames Control.Container.Busy;
+ begin
+ B := B + 1;
+ end;
end if;
end Adjust;
is
Ref : constant Constant_Reference_Type :=
(Element => Container.Reference.Element.all'Access,
- Control => (Controlled with Container.Reference));
+ Control => (Controlled with Container'Unrestricted_Access));
+ B : Natural renames Ref.Control.Container.Busy;
+
begin
- Reference (Ref.Control.Container);
+ Reference (Ref.Control.Container.Reference);
+ B := B + 1;
return Ref;
end Constant_Reference;
overriding procedure Finalize (Control : in out Reference_Control_Type) is
begin
if Control.Container /= null then
- Unreference (Control.Container);
+ Unreference (Control.Container.Reference);
+ Control.Container.Busy := Control.Container.Busy - 1;
end if;
Control.Container := null;
is
Ref : constant Reference_Type :=
(Element => Container.Reference.Element.all'Access,
- Control => (Controlled with Container.Reference));
+ Control => (Controlled with Container'Unrestricted_Access));
begin
- Reference (Ref.Control.Container);
+ Reference (Ref.Control.Container.Reference);
+ Container.Busy := Container.Busy + 1;
return Ref;
end Reference;
use Ada.Streams;
type Element_Access is access all Element_Type;
+ type Holder_Access is access all Holder;
type Shared_Holder is record
Counter : System.Atomic_Counters.Atomic_Counter;
type Reference_Control_Type is new Controlled with
record
- Container : Shared_Holder_Access;
+ Container : Holder_Access;
end record;
overriding procedure Adjust (Control : in out Reference_Control_Type);