From d4969fafffd49c4791f56141d57281a83007a29b Mon Sep 17 00:00:00 2001 From: Andreas Monzner Date: Wed, 14 Nov 2007 14:56:16 +0000 Subject: fix frequently segfault on clean shutdown --- lib/base/ebase.cpp | 10 ++++++++++ lib/base/ebase.h | 8 +------- 2 files changed, 11 insertions(+), 7 deletions(-) (limited to 'lib/base') diff --git a/lib/base/ebase.cpp b/lib/base/ebase.cpp index 08c15610..effd7250 100644 --- a/lib/base/ebase.cpp +++ b/lib/base/ebase.cpp @@ -116,6 +116,16 @@ void eTimer::addTimeOffset( int offset ) // mainloop ePtrList eMainloop::existing_loops; +eMainloop::~eMainloop() +{ + existing_loops.remove(this); + pthread_mutex_destroy(&recalcLock); + for (std::map::iterator it(notifiers.begin());it != notifiers.end();++it) + it->second->stop(); + while(m_timer_list.begin() != m_timer_list.end()) + m_timer_list.begin()->stop(); +} + void eMainloop::addSocketNotifier(eSocketNotifier *sn) { int fd = sn->getFD(); diff --git a/lib/base/ebase.h b/lib/base/ebase.h index bab1b5f3..4378711a 100644 --- a/lib/base/ebase.h +++ b/lib/base/ebase.h @@ -217,13 +217,7 @@ public: existing_loops.push_back(this); pthread_mutex_init(&recalcLock, 0); } - virtual ~eMainloop() - { - existing_loops.remove(this); - pthread_mutex_destroy(&recalcLock); - for (std::map::iterator it(notifiers.begin());it != notifiers.end();++it) - it->second->stop(); - } + virtual ~eMainloop(); int looplevel() { return loop_level; } -- cgit v1.2.3