HaxeFoundation / HaxeFoundation/haxe

HXCPP_CHECK_POINTER does not work in some situations

Open
#7,253 2 comments 0 reactions 1 assignee Claimed by @hughsando View on GitHub
bug feature-ide platform-cpp
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

Expected that in debug mode it must check all pointers it haxe generated code. Is it so?

For eg this code is crashes unexpectedly:
```haxe
package;

interface ISomeInterface
{
function getSomeProperty():Float;
}

class SomeClass {
var nullPointer:ISomeInterface;

public var someProperty(get, null):Float;

public function new() {}

function get_someProperty():Float {
return nullPointer.getSomeProperty();
}
}

class Main
{
public static function main(): Void
{
var inst = new SomeClass();
trace("Begin");
trace("Begin case 1");
try {
var unexistProperty = Reflect.getProperty(inst, "unexistProperty");
trace(unexistProperty.some);
}
catch(e:Dynamic) {
trace(e); //Null Object Reference - works as expected
}
trace("End case 1");

trace("Begin case 2");
try {
var val = Reflect.getProperty(inst, "someProperty"); //Just crash
trace(val);
}
catch(e:Any) {
trace(e);
}
trace("End case 2");
trace("Finish");
}
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.