This is a simple example:
Sqrat::Object sqObj = Sqrat::RootTable( Sqrat::DefaultVM::Get() );
sqObj = sqObj;
Now sqObj is null, against expectations.
The operator= should probably do nothing when this type of assignment happens, or the intrinsic should be rethought.
Sorry, meant to say "or the intrinsic sq_resetobject should be rethought."
The sq_resetobject call probably needs to stay immediately after the sq_release call (problems were introduced by not following this convention in other places before), and so the issue should be fixed by checking if the object is the same. I also took the liberty of removing the release = so.release part because it felt correct to, but that might be wrong.
If you could check if that works and do a pull request it'd be appreciated!
Sorry, it's a bit more complicated than that:
error C2678: binary '!=': no operator found which takes a left-hand operand of type 'HSQOBJECT' (or there is no acceptable conversion)
Last edit: shatteredmoon 2020-11-06
I mistook HSQOBJECT to by a typedef to a pointer. As long as every Sqrat::Object has its own unique HSQOBJECT, the following will work as far as I can tell.
Yes, this does the trick, thanks!
Nevermind, just saw your reply
Last edit: shatteredmoon 2020-11-06
Fixed in https://sourceforge.net/p/scrat/code/ci/36392c35317708a3616f24f6742d163002b8ee7a/