Fixed: Respect coding standard for "parser" variable and delete it in destructor (fix a memory leak)

--HG--
branch : develop
This commit is contained in:
kervala 2016-12-04 16:52:50 +01:00
parent 13154bd79d
commit 8cc3963ddd
2 changed files with 11 additions and 10 deletions

View file

@ -502,7 +502,7 @@ namespace NLGUI
const CEventDescriptorKey& getLastKeyEvent() const{ return lastKeyEvent; }
IParser* getParser() const{ return parser; }
IParser* getParser() const{ return _Parser; }
/// Retrieves the Id of the currently selected widgets
void getEditorSelection( std::vector< std::string > &selection );
@ -536,7 +536,7 @@ namespace NLGUI
CWidgetManager();
~CWidgetManager();
IParser *parser;
IParser *_Parser;
static CWidgetManager *instance;
std::vector< SMasterGroup > _MasterGroups;

View file

@ -466,7 +466,7 @@ namespace NLGUI
// ------------------------------------------------------------------------------------------------
CInterfaceElement* CWidgetManager::getElementFromDefine( const std::string &defineId )
{
return getElementFromId( parser->getDefine( defineId ) );
return getElementFromId( _Parser->getDefine( defineId ) );
}
// ------------------------------------------------------------------------------------------------
@ -2113,8 +2113,6 @@ namespace NLGUI
bool handled = false;
CViewPointer *_Pointer = static_cast< CViewPointer* >( getPointer() );
if( evnt.getType() == CEventDescriptor::system )
{
handleSystemEvent( evnt );
@ -3276,7 +3274,7 @@ namespace NLGUI
// ------------------------------------------------------------------------------------------------
void CWidgetManager::startAnim( const std::string &animId )
{
CInterfaceAnim *pIT = parser->getAnim( animId );
CInterfaceAnim *pIT = _Parser->getAnim( animId );
if( pIT == NULL )
return;
@ -3302,7 +3300,7 @@ namespace NLGUI
// ------------------------------------------------------------------------------------------------
void CWidgetManager::stopAnim( const std::string &animId )
{
CInterfaceAnim *pIT = parser->getAnim( animId );
CInterfaceAnim *pIT = _Parser->getAnim( animId );
for( uint i = 0; i < activeAnims.size(); ++i )
if( activeAnims[ i ] == pIT )
@ -3325,7 +3323,7 @@ namespace NLGUI
void CWidgetManager::runProcedure( const std::string &procName, CCtrlBase *pCaller,
const std::vector< std::string> &paramList )
{
CProcedure *procp = parser->getProc( procName );
CProcedure *procp = _Parser->getProc( procName );
if( procp == NULL )
return;
@ -3361,7 +3359,7 @@ namespace NLGUI
void CWidgetManager::setProcedureAction( const std::string &procName, uint actionIndex,
const std::string &ah, const std::string &params )
{
CProcedure *procp = parser->getProc( procName );
CProcedure *procp = _Parser->getProc( procName );
if( procp == NULL )
return;
@ -3701,7 +3699,7 @@ namespace NLGUI
CReflectableRegister::registerClasses();
parser = IParser::createParser();
_Parser = IParser::createParser();
_Pointer = NULL;
curContextHelp = NULL;
@ -3743,6 +3741,9 @@ namespace NLGUI
delete _MasterGroups[i].Group;
}
delete _Parser;
_Parser = NULL;
_Pointer = NULL;
curContextHelp = NULL;