Problem exists in Code::Blocks 17.12 and nightly 11400 on Windows and Code::Blocks 16.01 on Debian.
Any project (.cbp) must be opened in Code::Blocks.
Typing following command in scripting console causes crash of Code::Blocks:
GetProjectManager().GetActiveProject().SetCommandsBeforeBuild(T("cmd /c mkdir abc"));
SetCommandsBeforeBuild takes const wxArrayString&, but in this command it gets const wxString&
Maybe there should be some type checking?
There should be underscore before T():
as far as i can tell, type checking for instances is hard with the current squirrel binding...
[EDIT:] THIS IS WRONG. sqplus implements type checking for instances. I check why this is not triggered here...
One possibility to clean this up would be to add a constructor for string for the wxStringArray type...
Last edit: bluehazzard 2018-07-17
But we should somehow prevent a fatal crash as it is happening at the moment...
Ok, i found the problem:
in include\scripting\sqplus\sqplus.h:539 the instance is get from the squirrel vm and type checking is done:
in
the type is checked:
and if it is false a
is raised and a not SQ_OK is returned. 'GetInstance' does not check the return type but the user pointer for null. This is wrong and will never fail...
Last edit: bluehazzard 2018-07-18
Found some discussion in the squirrel forum:
http://www.squirrel-lang.org/mainsite/forums/default.aspx?g=posts&m=2949
I have tried to fix it with the suggested version in the forum (i have not found the commit in sqplus yet) and it does not work for plugins like the scripted wizard.
The
cl->_typetag
and thetypetag
for the application and the plugin are different pointer to the same type....Ok, there are two ways to fix this:
1) update sqplus to the latest version: I think without future patching sqplus this will not work, because in the latest version they use the same pointer to static member as in the last versions, but they fixed the type checking...
2) Use the attached patch that should fix all problems... I have used
typeid
for type identification and fixed theGetInstance()
function...Last edit: bluehazzard 2018-07-18
Ok, i tried to update sqplus to the latest version and it would be a lot work to fix the bug with the static class identification, so i will put this aside....
We should move to your sq3+sqrat branch. But it requires many changes and experiments how to make handling of errors correctly. The current version didn't work well if I remember correctly.
I agree, but this patch prevents some serious crashes in the meantime...
It requires working RTTI, this is not really the case on linux when loading plugins with dlopen. Not sure if it affects the scripting engine, but I prefer if we don't find out late.
As far as i can tell my fix works on windows and linux (at least mint 18) and gcc (other compiler probably won't work, but we use gcc everywhere...)
Last edit: bluehazzard 2018-07-26