From d9134c53d393797adbbe79984d7a4b3327b07538 Mon Sep 17 00:00:00 2001 From: Adeel Kazmi Date: Thu, 21 Sep 2017 11:33:42 +0100 Subject: [PATCH] Avoid debug assert when Timer is destroyed item-view.example and clipping.example crash with debug builds without this patch Change-Id: Icacb213e435cdc831da24e146cc50f47a29b3e37 --- adaptors/common/event-loop/ecore/ecore-timer-impl.cpp | 19 +++++++++++-------- adaptors/common/timer-impl.h | 7 ++++++- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/adaptors/common/event-loop/ecore/ecore-timer-impl.cpp b/adaptors/common/event-loop/ecore/ecore-timer-impl.cpp index d392001..a05b13f 100644 --- a/adaptors/common/event-loop/ecore/ecore-timer-impl.cpp +++ b/adaptors/common/event-loop/ecore/ecore-timer-impl.cpp @@ -79,9 +79,7 @@ Timer::Timer( unsigned int milliSec ) Timer::~Timer() { - // stop timers - Stop(); - + ResetTimerData(); delete mImpl; } @@ -102,11 +100,7 @@ void Timer::Stop() // Timer should be used in the event thread DALI_ASSERT_DEBUG( Adaptor::IsAvailable() ); - if (mImpl->mId != NULL) - { - ecore_timer_del(mImpl->mId); - mImpl->mId = NULL; - } + ResetTimerData(); } void Timer::SetInterval( unsigned int interval ) @@ -159,6 +153,15 @@ Dali::Timer::TimerSignalType& Timer::TickSignal() return mTickSignal; } +void Timer::ResetTimerData() +{ + if (mImpl->mId != NULL) + { + ecore_timer_del(mImpl->mId); + mImpl->mId = NULL; + } +} + bool Timer::IsRunning() const { return mImpl->mId != NULL; diff --git a/adaptors/common/timer-impl.h b/adaptors/common/timer-impl.h index e8bc456..b5b105b 100644 --- a/adaptors/common/timer-impl.h +++ b/adaptors/common/timer-impl.h @@ -2,7 +2,7 @@ #define __DALI_INTERNAL_TIMER_H__ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -99,6 +99,11 @@ private: // Implementation Timer( const Timer& ); Timer& operator=( const Timer& ); + /** + * Resets any stored timer data. + */ + void ResetTimerData(); + private: // Data Dali::Timer::TimerSignalType mTickSignal; -- 2.7.4