Skip to content

UPD: better thread-safe TFileSource reference counting#2255

Open
xBZZZZ wants to merge 1 commit intodoublecmd:masterfrom
xBZZZZ:master
Open

UPD: better thread-safe TFileSource reference counting#2255
xBZZZZ wants to merge 1 commit intodoublecmd:masterfrom
xBZZZZ:master

Conversation

@xBZZZZ
Copy link
Contributor

@xBZZZZ xBZZZZ commented Apr 5, 2025

  1. works with latest freepascal ( https://gitlab.com/freepascal.org/fpc/source/-/commit/c3f80014b41db2cb4a6fa50a50c2548a03000124#note_2431141761 )
  2. impossible to find IFileSource during constructing or destructing

note: there is code like: find {subclass of IFileSource} or create it if not found

Result := FileSourceManager.Find(TWcxArchiveFileSource, ArchiveFileName) as IArchiveFileSource;
if not Assigned(Result) then
begin
if ArchiveSign then
Result := TWcxArchiveFileSource.CreateByArchiveSign(SourceFileSource, ArchiveFileName)
else if (ArchiveType = EmptyStr) then
Result := TWcxArchiveFileSource.CreateByArchiveName(SourceFileSource, ArchiveFileName)
else
Result := TWcxArchiveFileSource.CreateByArchiveType(SourceFileSource, ArchiveFileName, ArchiveType, IncludeHidden);
end;

that is not thread safe, multiple of {subclass of IFileSource} can be created if code like that runs on multiple threads

todo: test plugins (only tested zip.wcx (seems like works))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant