Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Should I delete PLUGININFO::pszFunctions?

May
12,939
171
There's a discussion in the support forum about crash reports. I noted that I get crash reports randomly (and seldom) when TCC unloads my plugins. When I look at the plugins involved (back to the beginning of 2021) I see that the faulting module is ...

Code:
4utils64.dll 21 times
sysutils64.dll 0 times
4console64.dll 79 times
4threads64.dll 5 times

There's 1 difference between sysutils64.dll and the others and I wonder if that's significant. Except for sysutils64.dll, the plugins allocate PLUGININFO::pszFunctions in GetPluginInfo() and delete it in ShutdownPlugin(). Basically I do this (below). Should I be deleting PLUGININFO::pszFunctions? Should I do if only if TCC is NOT exiting?

Code:
LPPLUGININFO WINAPI GetPluginInfo( void )
{
    pluginfo.pszFunctions = new WCHAR[NUMBER_OF_ITEMS * 16]; // conservative
    WCHAR *p = pluginfo.pszFunctions;
    for ( INT i=0; i<NUMBER_OF_ITEMS; i++ ) // comma at end is OK
        p += wsprintf(p, L"%s,", item[i].Name);
    return &pluginfo;
}
    
BOOL WINAPI ShutdownPlugin( BOOL b4ntExit )
{
    if ( pluginfo.pszFunctions != NULL )
        delete [] pluginfo.pszFunctions;
    return FALSE;
}
 
Back
Top