Sign in to follow this  

Bug in 1.9.0 WIP 2 ?

This topic is 4855 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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;

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

This topic is 4855 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this