Bug in 1.9.0 WIP 2 ?

Started by
2 comments, last by abrken 19 years, 7 months ago
To reproduce :

	m_pAsEngine = (asIScriptEngineXPN *)asCreateScriptEngine(ANGELSCRIPT_VERSION);

	CString csTmpCode = "void sdf(){}\nvoid sdf(){}";
	m_pAsEngine->AddScriptSection("toto", "zefunc", csTmpCode, csTmpCode.GetLength());
	m_pAsEngine->Build("toto", NULL);
Do you see the error in the script ? Yes, I have entered 2 time the same function (sdf) ! You get an assert caused by:

void asCBuilder::CompileFunctions()
at

functions[n]->script->ConvertPosToRowCol(functions[n]->node->tokenPos, &r, &c);
To solve this problem that I did get in my project but for different reasons (I was calling two times the AddScriptSection without calling the build in between those two calls), I have call the Discard methos of asIScriptEngine. Then another bug appears. To Reproduce :

	CString csTmpCode = "void sdf(){}";
	m_pAsEngine->AddScriptSection("toto", "zefunc", csTmpCode, csTmpCode.GetLength());
	m_pAsEngine->Build("toto", NULL);
	m_pAsEngine->Discard("toto");
You get an assert caused by :

void asCModule::Discard()
at

delete this;
Advertisement
I'll look into these ASAP.

Thanks for the detailed reports, they will help me find the bugs faster.

I'm planning on having a new WIP release this weekend. The bug fixes will probably be in that one.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

I've found and fixed the bugs in 1.9.0 WIP 3.

For WIP 2 the bug fixes ought to be:

as_builder.cpp -> asCBuilder::RegisterScriptFunction() -> line 878:

change the "return -1;" to "break;"

as_module.cpp -> asCModule::Discard() -> line 131:

Exchange the complete function to the following:

void asCModule::Discard(){  if( contextCount == 0 )    delete this;  else    isDiscarded = true;}


I haven't tested those changes but I believe they should do the trick, as it is basically what I did in WIP 3. I've made too many other changes in WIP 3 to be sure without doing a complete test.

[Edited by - WitchLord on August 27, 2004 3:36:53 PM]

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

After the changes the result gives :
AddCharToCode (8, 1) : Error   : A function with the same name and parameters already exist


The Discard function do not result in an assert anymore.

Thank's !

I did not test it on WIP 3 but WIP 2.

This topic is closed to new replies.

Advertisement