hxcpp
hxcpp copied to clipboard
Telemetry crashed with null pointer exception
got a null pointer exception in this line while trying to profile with hxScout https://github.com/HaxeFoundation/hxcpp/blob/master/src/hx/Telemetry.cpp#L207
Exception thrown: read access violation.
this->_last_obj-> was nullptr.
this is callstack
I've been able to prevent this error by changing #L205 to the following.
if (exist != alloc_map.end() && _last_obj!=(NULL) && *(int**)_last_obj != 0) {
I have no idea what's going on here so I wouldn't try pushing that change myself (maybe it's just hiding a deeper issue?), but it seems to make everything work okay for me.
I have the same problem. I think the problem starts in file Telemetry.cpp , at function Telemetry.HXTAllocation. When casting, it is assumed that the transmitted variable is a pointer to the hx::Object. Either this assumption is violated (and something else is transmitted). Either (which is worse), somewhere the object is incorrectly cleared. I still use the fix from the post above. However, in fact, an indefinite behavior is obtained, since no one guarantees the presence of a pointer to a table of virtual functions at the beginning of the object.
if (exist != alloc_map.end() && _last_obj!=(NULL) && (int*)_last_obj != 0) {
I was having the same issues, this fixed it, thanks!