aboutsummaryrefslogtreecommitdiff
path: root/lib/base/ebase.cpp
diff options
context:
space:
mode:
authorFelix Domke <tmbinc@elitedvb.net>2008-11-18 22:21:59 +0100
committerFelix Domke <tmbinc@elitedvb.net>2008-11-18 22:21:59 +0100
commit6f40eb87fa80a25d0b53b027af82856a66cf6997 (patch)
tree990fd438c5aa52dda1076e2f5b6b640bc5958192 /lib/base/ebase.cpp
parent6034a35be47b6e1e4f0599547fd4228e7ff0b4fd (diff)
parenta8455f54b7c4eeb1ebf769e7194a089098ab4959 (diff)
downloadenigma2-6f40eb87fa80a25d0b53b027af82856a66cf6997.tar.gz
enigma2-6f40eb87fa80a25d0b53b027af82856a66cf6997.zip
Merge branch 'master' of git.opendreambox.org:/git/enigma2
Diffstat (limited to 'lib/base/ebase.cpp')
-rw-r--r--lib/base/ebase.cpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/lib/base/ebase.cpp b/lib/base/ebase.cpp
index bd2ec589..313732ab 100644
--- a/lib/base/ebase.cpp
+++ b/lib/base/ebase.cpp
@@ -126,6 +126,17 @@ eMainloop::~eMainloop()
void eMainloop::addSocketNotifier(eSocketNotifier *sn)
{
int fd = sn->getFD();
+ 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 +254,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);