+ patch by Bart B: TBucketList threw access violations after Clear, resolves #39565

+ test
This commit is contained in:
florian 2022-02-16 23:00:02 +01:00
parent bcab6185b9
commit 9ad2bdcecd
4 changed files with 11 additions and 3 deletions

View File

@ -2579,6 +2579,7 @@ end;
destructor TCustomBucketList.Destroy; destructor TCustomBucketList.Destroy;
begin begin
Clear; Clear;
SetLength(FBuckets,0);
inherited Destroy; inherited Destroy;
end; end;
@ -2593,7 +2594,6 @@ begin
for J:=B.Count-1 downto 0 do for J:=B.Count-1 downto 0 do
DeleteItem(I,J); DeleteItem(I,J);
end; end;
SetLength(FBuckets,0);
end; end;
Function TCustomBucketList.Add(AItem, AData: Pointer): Pointer; Function TCustomBucketList.Add(AItem, AData: Pointer): Pointer;

View File

@ -2486,7 +2486,7 @@ export LOG:=$(TEST_OUTPUTDIR)/log
endif endif
LOGFILES=$(TEST_OUTPUTDIR)/log $(TEST_OUTPUTDIR)/longlog $(TEST_OUTPUTDIR)/faillist LOGFILES=$(TEST_OUTPUTDIR)/log $(TEST_OUTPUTDIR)/longlog $(TEST_OUTPUTDIR)/faillist
LOGEXT=.testlog .tbslog .tbflog .webtbslog .webtbflog LOGEXT=.testlog .tbslog .tbflog .webtbslog .webtbflog
TESTUNITDIRS=system dos crt objects strings sysutils math sharemem strutils matrix lineinfo ucomplex fpwidestring cpu fmtbcd windows classes character dateutil fpcunit softfpu variants sortbase sortalgs linux unixutil types nullable TESTUNITDIRS=system dos crt objects strings sysutils math sharemem strutils matrix lineinfo ucomplex fpwidestring cpu fmtbcd windows classes character dateutil fpcunit softfpu variants sortbase sortalgs linux unixutil types nullable contnrs
TESTDIRECTDIRS= TESTDIRECTDIRS=
TESTSUBDIRS=cg cg/variants cg/cdecl cpu16 cpu16/i8086 library opt $(addprefix units/,$(TESTUNITDIRS)) TESTSUBDIRS=cg cg/variants cg/cdecl cpu16 cpu16/i8086 library opt $(addprefix units/,$(TESTUNITDIRS))
TESTPACKAGESDIRS=win-base webtbs hash fcl-registry fcl-process zlib fcl-db fcl-xml cocoaint bzip2 fcl-net TESTPACKAGESDIRS=win-base webtbs hash fcl-registry fcl-process zlib fcl-db fcl-xml cocoaint bzip2 fcl-net

View File

@ -159,7 +159,7 @@ LOGFILES=$(TEST_OUTPUTDIR)/log $(TEST_OUTPUTDIR)/longlog $(TEST_OUTPUTDIR)/faill
LOGEXT=.testlog .tbslog .tbflog .webtbslog .webtbflog LOGEXT=.testlog .tbslog .tbflog .webtbslog .webtbflog
# Subdirs available in the test subdir # Subdirs available in the test subdir
TESTUNITDIRS=system dos crt objects strings sysutils math sharemem strutils matrix lineinfo ucomplex fpwidestring cpu fmtbcd windows classes character dateutil fpcunit softfpu variants sortbase sortalgs linux unixutil types nullable TESTUNITDIRS=system dos crt objects strings sysutils math sharemem strutils matrix lineinfo ucomplex fpwidestring cpu fmtbcd windows classes character dateutil fpcunit softfpu variants sortbase sortalgs linux unixutil types nullable contnrs
TESTDIRECTDIRS= TESTDIRECTDIRS=
TESTSUBDIRS=cg cg/variants cg/cdecl cpu16 cpu16/i8086 library opt $(addprefix units/,$(TESTUNITDIRS)) TESTSUBDIRS=cg cg/variants cg/cdecl cpu16 cpu16/i8086 library opt $(addprefix units/,$(TESTUNITDIRS))
TESTPACKAGESDIRS=win-base webtbs hash fcl-registry fcl-process zlib fcl-db fcl-xml cocoaint bzip2 fcl-net TESTPACKAGESDIRS=win-base webtbs hash fcl-registry fcl-process zlib fcl-db fcl-xml cocoaint bzip2 fcl-net

View File

@ -0,0 +1,8 @@
program Project1;
uses contnrs;
var b:TBucketList;
begin
b:=TBucketList.Create();
b.Clear();
b.Add(nil,nil);
end.