Browse Source

* ensure that current_settings.pmessage is reset when doing a replay and when loading the current message state from the token stream

Sven/Sarah Barth 7 months ago
parent
commit
3ba27d3160
1 changed files with 5 additions and 1 deletions
  1. 5 1
      compiler/scanner.pas

+ 5 - 1
compiler/scanner.pas

@@ -3721,6 +3721,9 @@ type
         { install buffer }
         { install buffer }
         replaytokenbuf:=buf;
         replaytokenbuf:=buf;
 
 
+        { ensure that existing message state records won't be freed }
+        current_settings.pmessage:=nil;
+
         { flushpendingswitchesstate should have been called }
         { flushpendingswitchesstate should have been called }
         if assigned(pendingstate.nextmessagerecord) then
         if assigned(pendingstate.nextmessagerecord) then
           internalerror(2024122901);
           internalerror(2024122901);
@@ -3863,7 +3866,8 @@ type
                       end;
                       end;
                     ST_LOADMESSAGES:
                     ST_LOADMESSAGES:
                       begin
                       begin
-                        { free pending messages }
+                        { free current and pending messages }
+                        FreeLocalVerbosity(current_settings.pmessage);
                         FreeLocalVerbosity(pendingstate.nextmessagerecord);
                         FreeLocalVerbosity(pendingstate.nextmessagerecord);
                         { the message settings are stored from newest to oldest
                         { the message settings are stored from newest to oldest
                           change for the whole stack, so we only want to apply
                           change for the whole stack, so we only want to apply