aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--unicode/src/base/UCovers.pas3
-rw-r--r--unicode/src/base/UFilesystem.pas6
2 files changed, 8 insertions, 1 deletions
diff --git a/unicode/src/base/UCovers.pas b/unicode/src/base/UCovers.pas
index 0dbe672a..6c7c9e48 100644
--- a/unicode/src/base/UCovers.pas
+++ b/unicode/src/base/UCovers.pas
@@ -385,6 +385,9 @@ begin
end
else
begin
+ // FillChar() does not decrement the ref-count of ref-counted fields
+ // -> reset Name field manually
+ Result.Name := nil;
FillChar(Result, SizeOf(TTexture), 0);
end;
except on E: Exception do
diff --git a/unicode/src/base/UFilesystem.pas b/unicode/src/base/UFilesystem.pas
index a28b1f39..d4972df5 100644
--- a/unicode/src/base/UFilesystem.pas
+++ b/unicode/src/base/UFilesystem.pas
@@ -665,7 +665,11 @@ function TFileIterator.Next(): TFileInfo;
begin
if (not fHasNext) then
begin
- FillChar(Result, SizeOf(Result), 0);
+ // Note: do not use FillChar() on records with ref-counted fields
+ Result.Time := 0;
+ Result.Size := 0;
+ Result.Attr := 0;
+ Result.Name := nil;
Exit;
end;