diff options
| author | ghost <andreas.monzner@multimedia-labs.de> | 2008-11-18 16:17:28 +0100 |
|---|---|---|
| committer | ghost <andreas.monzner@multimedia-labs.de> | 2008-11-18 16:17:28 +0100 |
| commit | ea644879586a9472041552d84dd7b7ebba29ec3e (patch) | |
| tree | 7d4f875dbabc94887d78ff83ead0f8aebab30d06 /lib/base | |
| parent | 1d042d155d0f33d2777e47da082b24b49a503491 (diff) | |
| download | enigma2-ea644879586a9472041552d84dd7b7ebba29ec3e.tar.gz enigma2-ea644879586a9472041552d84dd7b7ebba29ec3e.zip | |
fix FATAL: ebase.cpp:129 ASSERTION notifiers.find(fd) == notifiers.end() FAILED!
Diffstat (limited to 'lib/base')
| -rw-r--r-- | lib/base/ebase.cpp | 23 | ||||
| -rw-r--r-- | lib/base/ebase.h | 3 |
2 files changed, 20 insertions, 6 deletions
diff --git a/lib/base/ebase.cpp b/lib/base/ebase.cpp index bd2ec589..f42b72b8 100644 --- a/lib/base/ebase.cpp +++ b/lib/base/ebase.cpp @@ -126,6 +126,18 @@ eMainloop::~eMainloop() void eMainloop::addSocketNotifier(eSocketNotifier *sn) { int fd = sn->getFD(); + std::map<int, eSocketNotifier*>::iterator it(notifiers.find(fd)); + if (m_inActivate && m_inActivate->ref.count == 1) + { + /* when the current active SocketNotifier's refcount is one, + then no more external references are existing. + So it gets destroyed when the activate callback is finished (->AddRef() / ->Release() calls in processOneEvent). + But then the sn->stop() is called to late for the next Asserion. + Thus we call sn->stop() here (this implicitly calls eMainloop::removeSocketNotifier) and we don't get trouble + with the next Assertion. + */ + m_inActivate->stop(); + } ASSERT(notifiers.find(fd) == notifiers.end()); notifiers[fd]=sn; } @@ -243,14 +255,15 @@ int eMainloop::processOneEvent(unsigned int twisted_timeout, PyObject **res, ePy if (it != notifiers.end() && it->second->state == 1) // added and in poll { - eSocketNotifier *sn = it->second; - int req = sn->getRequested(); + m_inActivate = it->second; + int req = m_inActivate->getRequested(); if (pfd[i].revents & req) { - sn->AddRef(); - sn->activate(pfd[i].revents & req); - sn->Release(); + m_inActivate->AddRef(); + m_inActivate->activate(pfd[i].revents & req); + m_inActivate->Release(); } pfd[i].revents &= ~req; + m_inActivate = 0; } if (pfd[i].revents & (POLLERR|POLLHUP|POLLNVAL)) eDebug("poll: unhandled POLLERR/HUP/NVAL for fd %d(%d)", pfd[i].fd, pfd[i].revents); diff --git a/lib/base/ebase.h b/lib/base/ebase.h index 84845a95..524052bd 100644 --- a/lib/base/ebase.h +++ b/lib/base/ebase.h @@ -195,6 +195,7 @@ class eMainloop int processOneEvent(unsigned int user_timeout, PyObject **res=0, ePyObject additional=ePyObject()); int retval; int m_is_idle; + eSocketNotifier *m_inActivate; int m_interrupt_requested; timespec m_twisted_timer; // twisted timer @@ -209,7 +210,7 @@ public: #endif eMainloop() - :app_quit_now(0),loop_level(0),retval(0), m_is_idle(0), m_interrupt_requested(0) + :app_quit_now(0),loop_level(0),retval(0), m_is_idle(0), m_inActivate(0), m_interrupt_requested(0) { existing_loops.push_back(this); } |
