diff --git a/cpptime.h b/cpptime.h index 8bd55e7..901381c 100644 --- a/cpptime.h +++ b/cpptime.h @@ -288,10 +288,10 @@ class Timer // Remove time event time_events.erase(time_events.begin()); - + auto tempHandler = events[te.ref].handler; // Invoke the handler lock.unlock(); - events[te.ref].handler(te.ref); + tempHandler(te.ref); lock.lock(); if(events[te.ref].valid && events[te.ref].period.count() > 0) {