aboutsummaryrefslogtreecommitdiff
path: root/lib/base
diff options
context:
space:
mode:
authorFelix Domke <tmbinc@elitedvb.net>2009-02-11 12:52:48 +0100
committerFelix Domke <tmbinc@elitedvb.net>2009-02-11 12:52:48 +0100
commitbbfcb7ea1f040d030277e2b6f2efa9ea0967bf2b (patch)
treec5945c791698c14723e989449e6b4bfcc275c05d /lib/base
parent4f7990ff2a55874b9eb65e3c9cd47dacb9f76deb (diff)
parent5e6f814d005a01caa437a532e61f4b338617ff67 (diff)
downloadenigma2-bbfcb7ea1f040d030277e2b6f2efa9ea0967bf2b.tar.gz
enigma2-bbfcb7ea1f040d030277e2b6f2efa9ea0967bf2b.zip
Merge branch 'master' of /home/tmbinc/enigma2-git into tmbinc/FixTimingBugs
Conflicts: lib/dvb/decoder.cpp
Diffstat (limited to 'lib/base')
-rw-r--r--lib/base/ebase.cpp22
-rw-r--r--lib/base/ebase.h3
-rw-r--r--lib/base/eerror.cpp12
-rw-r--r--lib/base/nconfig.cpp1
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);