Amiga: System CloseList() and CleanupThreadProcChain() are called after the memory manager is already shut down changed to native os memory allocation

This commit is contained in:
Marcus Sackrow 2023-02-18 20:19:46 +01:00 committed by Karoly Balogh
parent cd83438cb0
commit ac93ad48e3
2 changed files with 11 additions and 7 deletions

View File

@ -57,7 +57,7 @@ begin
while l<>nil do begin
tmpNext:=l;
l:=l^.next;
dispose(tmpNext);
FreePooled(ASYS_heapPool, tmpNext, SizeOf(TFileList));
end;
ReleaseSemaphore(ASYS_fileSemaphore);
end;
@ -80,13 +80,15 @@ begin
else p:=p^.next;
p:=nil;
end else begin
{ if the list is not yet allocated, allocate it. }
New(l);
{ if the list is not yet allocated, allocate it.
the FileList is only freed after the memory manager has shut
down, therefore native OS allocation }
l := AllocPooled(ASYS_heapPool,sizeof(TFileList));
l^.next:=nil;
end;
if not inList then begin
New(p);
P := AllocPooled(ASYS_heapPool,sizeof(TFileList));
p^.handle:=h;
p^.buffered:=False;
p^.next:=l^.next;
@ -121,7 +123,7 @@ begin
if inList then begin
tmpList:=p^.next^.next;
dispose(p^.next);
FreePooled(ASYS_heapPool, p^.next, SizeOf(TFileList));
p^.next:=tmpList;
end
{$IFDEF ASYS_FPC_FILEDEBUG}

View File

@ -211,7 +211,9 @@ Procedure AddThreadProc(var procList: PThreadProcInfo; Proc: TProcedure);
var
P : PThreadProcInfo;
Begin
New(P);
// the ThreadProc chain is only freed after the memory manager has
// shut down, therefore native OS allocation
P := AllocPooled(ASYS_heapPool,sizeof(TThreadProcInfo));
P^.Next:=procList;
P^.Proc:=Proc;
procList:=P;
@ -225,7 +227,7 @@ Begin
begin
p:=procList;
procList:=procList^.next;
dispose(p);
FreePooled(ASYS_heapPool,P,sizeof(TThreadProcInfo));
end;
End;