# Problem with child funcdef registration

## Recommended Posts

Hello,

Not sure if this is the proper spot to report (potential) bugs, but I've run into a problem when using child defs. This is my situation:

TRY_REGISTER(pEngine->RegisterObjectType("MyTemp<class T>", 0, asOBJ_REF | asOBJ_TEMPLATE | asOBJ_GC));
TRY_REGISTER(pEngine->RegisterFuncdef("void MyTemp<T>::Func(const T&in if_handle_then_const param)"));

I then register a specialization, like so:

TRY_REGISTER(pEngine->RegisterObjectType("MyTemp<void>", 0, asOBJ_REF | asOBJ_GC));
TRY_REGISTER(pEngine->RegisterFuncdef("void MyTemp<void>::Func()"));

Now when shutting down the engine, this crashes my application, because asCScriptEngine::RemoveFuncdef is called for my second funcDef  and this will remove it from the funcDef list of the engine, but it is kept inside the defaultGroup.types list. So when the engine does defaultGroup.RemoveConfiguration it crashes when it tries to access the deleted funcdef.

To fix this locally, I just removed the funcdef from any group type lists as well in asCScriptEngine::RemoveFuncdef, but this rather looks like a ref count gone wrong somewhere.

Am I missing something? I don't need to use the type to repro this crash, so it doesn't look like I'm messing up my ref counts on the application side. Just registering the funcdef and not using it anywhere as part of any function declarations is enough to trigger this crash.

Regards,

Bert

##### Share on other sites

It does indeed appear to be a bug. I'll investigate it.

What version of the library are you using?

Regards,

Andreas

##### Share on other sites

Hello Andreas,

I am using the latest SVN build for this. Thanks for looking into this!

Regards,

Bert

##### Share on other sites

I've fixed this in revision 2594

Sorry for the delay.

## Create an account

Register a new account

• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 10
• 15
• 22
• 19
• 46