I get an assert failure in debug mode when I discard of my script modules. I have a very minimal test case where I can reproduce the assert failure easily. The code works as intended but it makes me wonder if I am doing everything correctly.
The complete script in this case is a one line thing like this:
float time = 0.0f;
I am using the CScriptBuilder add-on to build the thing. Basically calling StartNewModule(), AddSectionFromMemory() supplying the above code string, BuildModule() and finally GetModule() to get the compiled module. BuildModule() returns 0.
If I immediately call Discard() on the module I get an assert in as_module.cpp, line 741. The expression is "asASSERT( (*globIt)->refCount.get() == 1 );"
Looking at the script module in the watch window the scriptGlobals array has one entry with the name "time" and refCount 2.
Should I somehow be releasing the global variables before calling Discard? I apologize if this is explained in the tutorial, I could not find anything related to this.
Cheers!