From 0c59a4279f93f08fe95fca5f2e55f3e025f0cceb Mon Sep 17 00:00:00 2001 From: Andreas Monzner Date: Wed, 29 Oct 2008 22:44:53 +0000 Subject: also use refcounting for eTimers its now no more possible directly to call new eTimer .. or to embedded eTimer. to create a eTimer now eTimer::create must be used... to delete you must call ->AddRef() after timer creation and ->Release when the timer is no more needed. Or use ePtr to store the timer reference.. then its enough to set the ePtr object to 0 when the timer is no more needed --- lib/components/file_eraser.cpp | 8 ++++---- lib/components/file_eraser.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'lib/components') diff --git a/lib/components/file_eraser.cpp b/lib/components/file_eraser.cpp index eb9c82f3..031c30dd 100644 --- a/lib/components/file_eraser.cpp +++ b/lib/components/file_eraser.cpp @@ -11,12 +11,12 @@ eBackgroundFileEraser *eBackgroundFileEraser::instance; eBackgroundFileEraser::eBackgroundFileEraser() - :messages(this,1), stop_thread_timer(this) + :messages(this,1), stop_thread_timer(eTimer::create(this)) { if (!instance) instance=this; CONNECT(messages.recv_msg, eBackgroundFileEraser::gotMessage); - CONNECT(stop_thread_timer.timeout, eBackgroundFileEraser::idle); + CONNECT(stop_thread_timer->timeout, eBackgroundFileEraser::idle); } void eBackgroundFileEraser::idle() @@ -44,7 +44,7 @@ void eBackgroundFileEraser::thread() runLoop(); - stop_thread_timer.stop(); + stop_thread_timer->stop(); } void eBackgroundFileEraser::erase(const char *filename) @@ -76,7 +76,7 @@ void eBackgroundFileEraser::gotMessage(const Message &msg ) eDebug("file %s erased", msg.filename); free((char*)msg.filename); } - stop_thread_timer.start(1000, true); // stop thread in one seconds + stop_thread_timer->start(1000, true); // stop thread in one seconds break; case Message::quit: quit(0); diff --git a/lib/components/file_eraser.h b/lib/components/file_eraser.h index 6cb13dda..fd11eca8 100644 --- a/lib/components/file_eraser.h +++ b/lib/components/file_eraser.h @@ -25,7 +25,7 @@ class eBackgroundFileEraser: public eMainloop, private eThread, public Object void gotMessage(const Message &message); void thread(); void idle(); - eTimer stop_thread_timer; + ePtr stop_thread_timer; #ifndef SWIG public: #endif -- cgit v1.2.3