Skip to content

Commit 5b3ab16

Browse files
committed
init eventmgr as a unique pointer
1 parent b1766e9 commit 5b3ab16

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

LuaEngine.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,10 @@ Eluna::Eluna(Map* map) :
5050
event_level(0),
5151
push_counter(0),
5252
boundMap(map),
53-
54-
L(NULL),
55-
eventMgr(NULL)
53+
L(NULL)
5654
{
5755
OpenLua();
58-
eventMgr = new EventMgr(this);
56+
eventMgr = std::make_unique<EventMgr>(this);
5957

6058
// if the script cache is ready, run scripts, otherwise flag state for reload
6159
if (sElunaLoader->GetCacheState() == SCRIPT_CACHE_READY)
@@ -67,8 +65,6 @@ eventMgr(NULL)
6765
Eluna::~Eluna()
6866
{
6967
CloseLua();
70-
delete eventMgr;
71-
eventMgr = NULL;
7268
}
7369

7470
void Eluna::CloseLua()

LuaEngine.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ class ELUNA_GAME_API Eluna
241241
public:
242242

243243
lua_State* L;
244-
EventMgr* eventMgr;
244+
std::unique_ptr<EventMgr> eventMgr;
245245

246246
#if defined ELUNA_TRINITY
247247
QueryCallbackProcessor queryProcessor;

0 commit comments

Comments
 (0)