* Properly reset state when (re)compiling, by Artem Izmaylov. Fixes issue #40825

This commit is contained in:
Michaël Van Canneyt 2024-06-20 11:52:02 +02:00
parent c261d5fdee
commit 9e8f09b93f
3 changed files with 11 additions and 0 deletions

View File

@ -716,6 +716,7 @@ implementation
end; end;
{ release procinfo tree } { release procinfo tree }
tprocinfo(procinfo).destroy_tree; tprocinfo(procinfo).destroy_tree;
procinfo := nil;
end; end;
DoneDebugInfo(self,current_debuginfo_reset); DoneDebugInfo(self,current_debuginfo_reset);
used_units.free; used_units.free;
@ -855,6 +856,7 @@ implementation
llvmmetadatastrings.free; llvmmetadatastrings.free;
llvmmetadatastrings:=TFPHashList.Create; llvmmetadatastrings:=TFPHashList.Create;
{$endif llvm} {$endif llvm}
ansistrdef:=nil;
wpoinfo.free; wpoinfo.free;
wpoinfo:=nil; wpoinfo:=nil;
checkforwarddefs.free; checkforwarddefs.free;
@ -903,6 +905,10 @@ implementation
linkorderedsymbols:=TCmdStrList.Create; linkorderedsymbols:=TCmdStrList.Create;
pendingspecializations.free; pendingspecializations.free;
pendingspecializations:=tfphashobjectlist.create(false); pendingspecializations:=tfphashobjectlist.create(false);
genericdummysyms.Free;
genericdummysyms := tfphashobjectlist.create(true);
extendeddefs.Free;
extendeddefs:=TFPHashObjectList.Create(true);
if assigned(waitingforunit) and if assigned(waitingforunit) and
(waitingforunit.count<>0) then (waitingforunit.count<>0) then
begin begin

View File

@ -2340,6 +2340,8 @@ var
else if (state in [ms_compile, ms_compiling_waitintf]) then else if (state in [ms_compile, ms_compiling_waitintf]) then
begin begin
{ no use continuing if we must be compiled } { no use continuing if we must be compiled }
// but we still need to restore current_module!
set_current_module(from_module);
exit(false) exit(false)
end end
else else

View File

@ -271,6 +271,9 @@ uses
if hmodule=current_module then if hmodule=current_module then
exit; exit;
if (hmodule.state = ms_load) and hmodule.interface_compiled then
Exit;
if not (hmodule.state in [ms_compiled,ms_processed]) then if not (hmodule.state in [ms_compiled,ms_processed]) then
begin begin
{$ifdef DEBUG_UNITWAITING} {$ifdef DEBUG_UNITWAITING}