Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HXCPP_CHECK_POINTER does not work in some situations #7253

Open
nulld opened this issue Jul 6, 2018 · 2 comments
Open

HXCPP_CHECK_POINTER does not work in some situations #7253

nulld opened this issue Jul 6, 2018 · 2 comments
Assignees
Labels
bug feature-ide IDE / Editor support platform-cpp Everything related to CPP / C++
Milestone

Comments

@nulld
Copy link

nulld commented Jul 6, 2018

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

For eg this code is crashes unexpectedly:

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");
 }
}
@nulld nulld changed the title HXCPP_CHECK_POINTER do not work in some situations HXCPP_CHECK_POINTER does not work in some situations Jul 6, 2018
@Gama11
Copy link
Member

Gama11 commented Jul 6, 2018

This is where it's crashing (even with HXCPP_CHECK_POINTER explicitly defined):

This is an issue for debugging, since it can lead to the entire application crashing when printing properties in the variables view (vshaxe/hxcpp-debugger#8).

@markknol markknol added bug platform-cpp Everything related to CPP / C++ labels Nov 28, 2018
@Simn Simn added this to the Bugs milestone Dec 12, 2018
@Gama11 Gama11 added the feature-ide IDE / Editor support label Jun 17, 2019
@Simn Simn modified the milestones: Bugs, Later Mar 24, 2023
@EliteMasterEric
Copy link
Contributor

image
image
Here's a screenshot of the error I receive in a barebones project based on the source code in the OP. Here's the source for that (I edited it to remove reflection in case that was part of the issue): https://github.com/EliteMasterEric/hxcpp-Issue7253

image
image
And here's a screenshot of the error I receive in another project (closed source at the moment). It appears in the same circumstances so I strongly suspect it is strongly related, but it may have a slightly different root cause due to the very different call stack

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug feature-ide IDE / Editor support platform-cpp Everything related to CPP / C++
Projects
None yet
Development

No branches or pull requests

6 participants