From 4002757765281f86d236d39b2c7e053a3ecc2af4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Heredero?= Date: Tue, 17 Oct 2023 15:12:51 +0200 Subject: [PATCH] test 2 done --- src/simplified/xf/core/behavior.cpp | 4 +--- src/simplified/xf/core/customevent.cpp | 2 +- src/simplified/xf/port/common/dispatcher.cpp | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) 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;