diff options
Diffstat (limited to 'lib/base')
| -rw-r--r-- | lib/base/ebase.cpp | 22 | ||||
| -rw-r--r-- | lib/base/ebase.h | 3 | ||||
| -rw-r--r-- | lib/base/eerror.cpp | 12 | ||||
| -rw-r--r-- | lib/base/nconfig.cpp | 1 |
4 files changed, 27 insertions, 11 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); 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); } diff --git a/lib/base/eerror.cpp b/lib/base/eerror.cpp index 1e4d348f..4c4d6551 100644 --- a/lib/base/eerror.cpp +++ b/lib/base/eerror.cpp @@ -77,7 +77,7 @@ int logOutputConsole=1; static pthread_mutex_t DebugLock = PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP; -extern void bsodFatal(); +extern void bsodFatal(const char *component); void eFatal(const char* fmt, ...) { @@ -86,10 +86,12 @@ void eFatal(const char* fmt, ...) va_start(ap, fmt); vsnprintf(buf, 1024, fmt, ap); va_end(ap); - singleLock s(DebugLock); - logOutput(lvlFatal, "FATAL: " + std::string(buf) + "\n"); - fprintf(stderr, "FATAL: %s\n",buf ); - bsodFatal(); + { + singleLock s(DebugLock); + logOutput(lvlFatal, "FATAL: " + std::string(buf) + "\n"); + fprintf(stderr, "FATAL: %s\n",buf ); + } + bsodFatal("enigma2"); } #ifdef DEBUG diff --git a/lib/base/nconfig.cpp b/lib/base/nconfig.cpp index 31b0a36f..106558ac 100644 --- a/lib/base/nconfig.cpp +++ b/lib/base/nconfig.cpp @@ -25,6 +25,7 @@ RESULT ePythonConfigQuery::getConfigValue(const char *key, std::string &value) if (PyString_Check(pRet)) { value.assign(PyString_AS_STRING(pRet)); + Py_DECREF(pRet); return 0; } Py_DECREF(pRet); |
