Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c810252

Browse files
committed
Do not return a dangling address
1 parent 061c166 commit c810252

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

test/native/tests/TestPtr.hx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,11 +180,12 @@ class TestPtr extends haxe.unit.TestCase{
180180
}
181181

182182
private static var output:cpp.Pointer<Array<Int>>;
183+
184+
private static var arrayValue:Array<Int>;
183185
private static function makeValue():{ a:cpp.Pointer<Array<Int>> }
184186
{
185-
var array = new Array<Int>();
186-
array.push(9);
187-
return { a: cpp.Pointer.addressOf(array) };
187+
arrayValue = [9];
188+
return { a: cpp.Pointer.addressOf(arrayValue) };
188189
}
189190

190191
@:analyzer(no_fusion)

0 commit comments

Comments
 (0)