From 2f175f0a4e85bd89a7c7d6c704f847a5dec88c00 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Wed, 29 Jul 2020 12:53:09 +0900 Subject: [PATCH] Test: fix the crash at DSZoneTest.registerCallbackWindowCreated Change-Id: If7516376623a7c80bb6d6a787312a7e6245a3daf --- src/DSZone/DSZone.cpp | 2 +- tests/DSZone-test.cpp | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/DSZone/DSZone.cpp b/src/DSZone/DSZone.cpp index 0e83d01..1dddd80 100644 --- a/src/DSZone/DSZone.cpp +++ b/src/DSZone/DSZone.cpp @@ -49,7 +49,7 @@ int DSZone::getHeight() void DSZone::registerCallbackWindowCreated(DSObject *slot, std::function)> func) { - this->__windowCreatedSignal.connect(slot, func); + __windowCreatedSignal.connect(slot, func); } void DSZone::callCallbackWindowCreated() diff --git a/tests/DSZone-test.cpp b/tests/DSZone-test.cpp index 8ec6a53..c6e32da 100644 --- a/tests/DSZone-test.cpp +++ b/tests/DSZone-test.cpp @@ -18,21 +18,24 @@ class TestZone : public DSObject { public: TestZone(std::shared_ptr zone) - : __boolOnWindowCreated(false), - __zone(nullptr) + : __boolOnWindowCreated(false) { - __zone->registerCallbackWindowCreated(this, std::bind(&TestZone::onWindowCreated, this, std::placeholders::_1)); + zone->registerCallbackWindowCreated(this, std::bind(&TestZone::onWindowCreated, this, std::placeholders::_1)); + __zone = zone; } + ~TestZone() {} void callOnWindowCreated() { __zone->callCallbackWindowCreated(); } + bool getResultOnWindowCreated() { return __boolOnWindowCreated; } - void onWindowCreated(std::shared_ptr) { + + void onWindowCreated(std::shared_ptr window) { __boolOnWindowCreated = true; } -- 2.7.4