Fix memory release

develop
kaetemi 4 years ago
parent 465a36b250
commit b220dac7b3

@ -69,7 +69,7 @@ namespace NLGUI
static CAHManager* getInstance()
{
if (_GlobalInstance == NULL)
if (_GlobalInstance == NULL && !s_Deleted)
_GlobalInstance = new CAHManager;
return _GlobalInstance;
}
@ -134,6 +134,19 @@ namespace NLGUI
static CAHManager *_GlobalInstance;
static bool editorMode;
class CDeleter
{
public:
~CDeleter()
{
delete _GlobalInstance;
_GlobalInstance = NULL;
s_Deleted = true;
}
};
static CDeleter s_Deleter;
static bool s_Deleted;
};
/// Ah name must all be lower case

@ -42,6 +42,8 @@ namespace NLGUI
// ------------------------------------------------------------------------------------------------
CAHManager *CAHManager::_GlobalInstance = NULL;
bool CAHManager::editorMode = false;
CAHManager::CDeleter CAHManager::s_Deleter;
bool CAHManager::s_Deleted = false;
// ------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------

Loading…
Cancel
Save