diff --git a/telldus-core/service/Event.cpp b/telldus-core/service/Event.cpp index d83d8445..b982d99a 100644 --- a/telldus-core/service/Event.cpp +++ b/telldus-core/service/Event.cpp @@ -28,9 +28,6 @@ EventBase::EventBase(EventHandler *handler) { } EventBase::~EventBase(void) { - if (d->handler) { - d->handler->removeEvent(this); - } delete d; } diff --git a/telldus-core/service/EventHandler.h b/telldus-core/service/EventHandler.h index 61c3d80a..44a220a2 100644 --- a/telldus-core/service/EventHandler.h +++ b/telldus-core/service/EventHandler.h @@ -9,7 +9,6 @@ public: virtual ~EventHandler(void); EventRef addEvent(); - bool removeEvent(EventBase *event); bool waitForAny(); diff --git a/telldus-core/service/EventHandler_unix.cpp b/telldus-core/service/EventHandler_unix.cpp index 93e97beb..2e10f7e0 100644 --- a/telldus-core/service/EventHandler_unix.cpp +++ b/telldus-core/service/EventHandler_unix.cpp @@ -26,6 +26,7 @@ EventHandler::~EventHandler(void) { std::list::const_iterator it = d->eventList.begin(); for(; it != d->eventList.end(); ++it) { + //We clear the handler if someone else still has a reference to the event (*it)->clearHandler(); } @@ -51,17 +52,6 @@ bool EventHandler::listIsSignalled(){ return false; } -bool EventHandler::removeEvent(EventBase *eventBase) { - Event *event = reinterpret_cast(eventBase); - if (!event) { - return false; - } - TelldusCore::MutexLocker locker(&d->listMutex); - //TODO! - //d->eventList.remove(event); - return true; -} - void EventHandler::signal(Event *event) { pthread_mutex_lock(&d->mutex); //event->setSignaled(); diff --git a/telldus-core/service/TelldusMain.cpp b/telldus-core/service/TelldusMain.cpp index ddc5dba2..a586cccf 100644 --- a/telldus-core/service/TelldusMain.cpp +++ b/telldus-core/service/TelldusMain.cpp @@ -88,7 +88,7 @@ void TelldusMain::start(void) { } } - if(handlerEvent->isSignaled()){ + if (handlerEvent->isSignaled()) { handlerEvent->popSignal(); for ( std::list::iterator it = clientCommunicationHandlerList.begin(); it != clientCommunicationHandlerList.end(); ){ if ((*it)->isDone()){