From 95dd3302c5d38a4ef4fbef1279fb4afcc1523bd2 Mon Sep 17 00:00:00 2001 From: Cyrille Comar Date: Tue, 14 Aug 2007 10:49:45 +0200 Subject: [PATCH] s-finimp.adb (Detach_From_Final_List): make this procedure idempotent since it is potentially used in cases implying... 2007-08-14 Cyrille Comar * s-finimp.adb (Detach_From_Final_List): make this procedure idempotent since it is potentially used in cases implying double finalization of the same object. From-SVN: r127462 --- gcc/ada/s-finimp.adb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gcc/ada/s-finimp.adb b/gcc/ada/s-finimp.adb index 4f6c4c165e4..4ed7c6ce1e8 100644 --- a/gcc/ada/s-finimp.adb +++ b/gcc/ada/s-finimp.adb @@ -258,7 +258,7 @@ package body System.Finalization_Implementation is ----------------------------- -- We know that the detach object is neither at the beginning nor at the - -- end of the list, thank's to the dummy First and Last Elements but the + -- end of the list, thanks to the dummy First and Last Elements, but the -- object may not be attached at all if it is Finalize_Storage_Only procedure Detach_From_Final_List (Obj : in out Finalizable) is @@ -273,6 +273,13 @@ package body System.Finalization_Implementation is SSL.Lock_Task.all; Obj.Next.Prev := Obj.Prev; Obj.Prev.Next := Obj.Next; + + -- Reset the pointers so that a new finalization of the same object + -- has no effect on the finalization list. + + Obj.Next := null; + Obj.Prev := null; + SSL.Unlock_Task.all; end if; -- 2.30.2