diff --git a/src/simplified/xf/core/behavior.cpp b/src/simplified/xf/core/behavior.cpp index 182c3e3..a1cc9e9 100644 --- a/src/simplified/xf/core/behavior.cpp +++ b/src/simplified/xf/core/behavior.cpp @@ -2,6 +2,7 @@ #include "xf/timeout.h" #include "xf/initialevent.h" #include "xf/behavior.h" +#include "trace/trace.h" // TODO done: Implement code for XFBehavior class @@ -10,9 +11,6 @@ XFBehavior::XFBehavior() { } XFBehavior::~XFBehavior() { - if (this->deleteOnTerminate()) { - delete this; - } } void XFBehavior::startBehavior() { diff --git a/src/simplified/xf/core/customevent.cpp b/src/simplified/xf/core/customevent.cpp index e3820b4..85637e0 100644 --- a/src/simplified/xf/core/customevent.cpp +++ b/src/simplified/xf/core/customevent.cpp @@ -4,7 +4,7 @@ XFCustomEvent::XFCustomEvent(int id, interface::XFBehavior *pBehavior): - XFEvent(XFEventType::Unknown, id){ + XFEvent(XFEventType::Event, id){ setBehavior(pBehavior); } diff --git a/src/simplified/xf/port/common/dispatcher.cpp b/src/simplified/xf/port/common/dispatcher.cpp index b7aa12a..012cc9d 100644 --- a/src/simplified/xf/port/common/dispatcher.cpp +++ b/src/simplified/xf/port/common/dispatcher.cpp @@ -37,7 +37,7 @@ void XFDispatcher::dispatchEvent(const XFEvent *pEvent) const { //Trace::out("[DEBUG] - Dispatch Event"); XFBehavior::TerminateBehavior terminateBehavior; terminateBehavior = pEvent->getBehavior()->process(pEvent); - if(terminateBehavior) { + if(terminateBehavior && pEvent->getBehavior()->deleteOnTerminate()) { delete pEvent->getBehavior(); if(pEvent->deleteAfterConsume()) { delete pEvent;