Jump to content

Weird crash when passing user class to plugin function


photo

Recommended Posts

We were suffering from a weird crash, that after a few hours of debugging was pinpointed to the following situation: near the end of the world script update, a plugin function was called with a user class as parameter, and after that the system script crashes on Wall::render. It seems to be caused by static Variable arg_variables[NUM_ARGUMENTS] in UnigineInterpreter.cpp, this array is never reset when it reaches the end of the world script update, leaving the arguments of the last API function called in there. When next a plugin function is called from the system script (as AppWall does) it will try to release this pointer from the Variable (releaseObject), but in the system script that user class is not existing, so it crashes on locating it in the namespaces vector.

 

It's a bit hard to provide a script to reproduce it, since it requires a custom plugin, it only seems to fail when passing a user class instance (as plain old Variable) through the API, and I couldn't find such a function in one of the default plugins (there Node::setVariable, but it's an extern function within the engine itself, not going through the API). The use case for passing this user class instance is basically that it's being stored as userdata (similar to Node::setVariable) that can later be retrieved back from script. We manged to work around the problem by exposing a dummy function and calling dummy( 0, 0, 0, 0, 0, 0, 0, 0, 0 ) at the end of the update() function in the world script (forcing it to clear all user classes in this static array), but it would be nice if this can be fixed in the engine of course.

Link to comment

Hi Michiel,

 

Thank you for the detailed description. Our dev team will take a look at this interpreter code.

 

If you could provide a small reproduceable sample - it will surely speed up debugging and fixing process. We will be very greatful for that :)

 

Thanks!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment
  • 2 months later...
×
×
  • Create New...