mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 20:39:13 +02:00
* don't increase refcounts for variants assigned to (ti_)const nodes, fixes
memory leak after r34288 and should have been done as part of r34287 (mantis #30546) git-svn-id: trunk@34440 -
This commit is contained in:
parent
26f6d2f39d
commit
2d051f89f7
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -13399,6 +13399,7 @@ tests/test/units/variants/tcustomvariant.pp svneol=native#text/plain
|
|||||||
tests/test/units/variants/tvararrayofintf.pp svneol=native#text/plain
|
tests/test/units/variants/tvararrayofintf.pp svneol=native#text/plain
|
||||||
tests/test/units/variants/tw26370.pp svneol=native#text/plain
|
tests/test/units/variants/tw26370.pp svneol=native#text/plain
|
||||||
tests/test/units/variants/tw27044.pp svneol=native#text/plain
|
tests/test/units/variants/tw27044.pp svneol=native#text/plain
|
||||||
|
tests/test/units/variants/tw30546.pp svneol=native#text/plain
|
||||||
tests/test/units/windows/twinrawinput32.pp svneol=native#text/plain
|
tests/test/units/windows/twinrawinput32.pp svneol=native#text/plain
|
||||||
tests/test/units/windows/twinrawinput64.pp svneol=native#text/plain
|
tests/test/units/windows/twinrawinput64.pp svneol=native#text/plain
|
||||||
tests/test/uobjc24.pp svneol=native#text/plain
|
tests/test/uobjc24.pp svneol=native#text/plain
|
||||||
|
@ -836,6 +836,7 @@ implementation
|
|||||||
{ call helpers for variant, they can contain non ref. counted types like
|
{ call helpers for variant, they can contain non ref. counted types like
|
||||||
vararrays which must be really copied }
|
vararrays which must be really copied }
|
||||||
else if (left.resultdef.typ=variantdef) and
|
else if (left.resultdef.typ=variantdef) and
|
||||||
|
not(is_const(left)) and
|
||||||
not(target_info.system in systems_garbage_collected_managed_types) then
|
not(target_info.system in systems_garbage_collected_managed_types) then
|
||||||
begin
|
begin
|
||||||
{ remove property flag to avoid errors, see comments for }
|
{ remove property flag to avoid errors, see comments for }
|
||||||
|
37
tests/test/units/variants/tw30546.pp
Normal file
37
tests/test/units/variants/tw30546.pp
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
{ %opt=-gh }
|
||||||
|
|
||||||
|
{$mode objfpc}
|
||||||
|
{$h+}
|
||||||
|
{$inline on}
|
||||||
|
|
||||||
|
uses
|
||||||
|
variants;
|
||||||
|
var
|
||||||
|
vv: variant;
|
||||||
|
|
||||||
|
function func: variant; inline;
|
||||||
|
begin
|
||||||
|
result:=vv;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function varconstinl(const v: variant): boolean; inline;
|
||||||
|
begin
|
||||||
|
result:=v='abc';
|
||||||
|
end;
|
||||||
|
|
||||||
|
function test: boolean; inline;
|
||||||
|
begin
|
||||||
|
result:=varconstinl(func);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure dotest;
|
||||||
|
begin
|
||||||
|
HaltOnNotReleased:=true;
|
||||||
|
vv:='abc';
|
||||||
|
if not test then
|
||||||
|
halt(1);
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
dotest;
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user