From 66378dafd9290c956c79886349ba896208ff6255 Mon Sep 17 00:00:00 2001 From: Martin Date: Sat, 20 Jul 2024 13:41:16 +0200 Subject: [PATCH] FpDebug: fix missing refcount / possible dangling pointer for TypeSymbol --- components/fpdebug/fpdbgdwarf.pas | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/fpdebug/fpdbgdwarf.pas b/components/fpdebug/fpdbgdwarf.pas index 6e33d01d79..d16902cfdb 100644 --- a/components/fpdebug/fpdbgdwarf.pas +++ b/components/fpdebug/fpdbgdwarf.pas @@ -2212,6 +2212,8 @@ end; constructor TFpValueDwarf.Create(ADwarfTypeSymbol: TFpSymbolDwarfType); begin FTypeSymbol := ADwarfTypeSymbol; + if FTypeSymbol <> nil then + FTypeSymbol.AddReference; inherited Create; end; @@ -2220,6 +2222,7 @@ begin FTypeCastSourceValue.ReleaseReference{$IFDEF WITH_REFCOUNT_DEBUG}(@FTypeCastSourceValue, ClassName+'.FTypeCastSourceValue'){$ENDIF}; FStructureValue.ReleaseReference{$IFDEF WITH_REFCOUNT_DEBUG}(@FStructureValue, 'TDbgDwarfSymbolValue'){$ENDIF}; FDataSymbol.ReleaseReference{$IFDEF WITH_REFCOUNT_DEBUG}(@FDataSymbol, ClassName+'.FDataSymbol'){$ENDIF}; + FTypeSymbol.ReleaseReference; inherited Destroy; end;