File tree Expand file tree Collapse file tree 2 files changed +7
-10
lines changed
Expand file tree Collapse file tree 2 files changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -112,20 +112,17 @@ void ElunaEventProcessor::RemoveEvent(LuaEvent* luaEvent)
112112 delete luaEvent;
113113}
114114
115- EventMgr::EventMgr (Eluna* _E) : globalProcessor( new ElunaEventProcessor(_E, NULL )), E(_E)
115+ EventMgr::EventMgr (Eluna* _E) : E(_E)
116116{
117+ globalProcessor = std::make_unique<ElunaEventProcessor>(E, nullptr );
117118}
118119
119120EventMgr::~EventMgr ()
120121{
121- {
122- if (!processors.empty ())
123- for (ProcessorSet::const_iterator it = processors.begin (); it != processors.end (); ++it) // loop processors
124- (*it)->RemoveEvents_internal ();
125- globalProcessor->RemoveEvents_internal ();
126- }
127- delete globalProcessor;
128- globalProcessor = NULL ;
122+ if (!processors.empty ())
123+ for (ProcessorSet::const_iterator it = processors.begin (); it != processors.end (); ++it) // loop processors
124+ (*it)->RemoveEvents_internal ();
125+ globalProcessor->RemoveEvents_internal ();
129126}
130127
131128void EventMgr::SetStates (LuaEventState state)
Original file line number Diff line number Diff line change @@ -96,7 +96,7 @@ class EventMgr
9696public:
9797 typedef std::unordered_set<ElunaEventProcessor*> ProcessorSet;
9898 ProcessorSet processors;
99- ElunaEventProcessor* globalProcessor;
99+ std::unique_ptr< ElunaEventProcessor> globalProcessor;
100100 Eluna* E;
101101
102102 EventMgr (Eluna* _E);
You can’t perform that action at this time.
0 commit comments