I have found that calling TAbZipKit.DeleteAt() before TAbZipKit.AddFromStream(), for the 3th time with the same filename, results in an EListError exception.
When using identical filenames, this takes just three attempts:
- TAbZipKit.AddFromStream()
- TAbZipKit.DeleteFiles()
- TAbZipKit.AddFromStream()
- TAbZipKit.DeleteFiles()
- TAbZipKit.AddFromStream() // <-- EListError: List index out of bounds (-1)
When using random filenames, this happens after the same filename is add/deleted three times.
The attached console program demonstrates this.
Exception seems to be caused by AddFromStream() and raised in TAbArchiveList.Get(), see stacktrace:
- Classes.TList.Get(???)
- TAbArchiveList.Get
- AbArcTyp.TAbArchiveList.Get(-1)
- AbArcTyp.TAbArchive.AddFromStream('file.txt', stream)
I have also seen:
- TAbCustomZipKit.ExtractToStream() causes TAbArchiveList.Get() to raise EListError
- TAbCustomZipKit.ExtractToStream() causes TAbArchive.FindFile() to raise EAccessViolation
- TAbCustomZipKit.ExtractToStream() causes TAbArchiveList.Find() to raise EPrivilege
Which is why DeleteAt() is my suspect. I do not grasp the internal hash mechanism, but perhaps it does not update the hash list correctly?
Tested with TpAbbrevia v5.0, svn revision 530.
I think i can further narrow it down and say that EListError occurs after DeleteAt() is called 3 times for files that where added by AddFromStream().
So whenever a file already exists in an opened file, it can be deleted 4 times in total.
Workaround is reopening whole archive after each DeleteAt(), as example shows.
Last edit: Barry Staes 2013-10-02
I can verify that the problem still exists in the latest svn revision 536.
Capeterson please run attached demo DPR to reproduce EListError exception and mark this issue as verified.