aboutsummaryrefslogtreecommitdiff
path: root/lib
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
parent6034a35be47b6e1e4f0599547fd4228e7ff0b4fd (diff)
parenta8455f54b7c4eeb1ebf769e7194a089098ab4959 (diff)
downloadenigma2-6f40eb87fa80a25d0b53b027af82856a66cf6997.tar.gz
enigma2-6f40eb87fa80a25d0b53b027af82856a66cf6997.zip
Merge branch 'master' of git.opendreambox.org:/git/enigma2
Diffstat (limited to 'lib')
-rw-r--r--lib/base/ebase.cpp22
-rw-r--r--lib/base/ebase.h3
-rw-r--r--lib/gdi/picload.cpp12
3 files changed, 25 insertions, 12 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/gdi/picload.cpp b/lib/gdi/picload.cpp
index 375f33fb..0fafeabd 100644
--- a/lib/gdi/picload.cpp
+++ b/lib/gdi/picload.cpp
@@ -1015,12 +1015,12 @@ RESULT ePicLoad::setPara(PyObject *val)
return 0;
else {
ePyObject fast = PySequence_Fast(val, "");
- m_conf.max_x = PyInt_AsLong( PySequence_Fast_GET_ITEM(val, 0));
- m_conf.max_y = PyInt_AsLong( PySequence_Fast_GET_ITEM(val, 1));
- m_conf.aspect_ratio = (double)PyInt_AsLong( PySequence_Fast_GET_ITEM(val, 2)) / PyInt_AsLong(PySequence_Fast_GET_ITEM(val, 3));
- m_conf.usecache = PyInt_AsLong( PySequence_Fast_GET_ITEM(val, 4));
- m_conf.resizetype = PyInt_AsLong( PySequence_Fast_GET_ITEM(val, 5));
- const char *bg_str = PyString_AsString( PySequence_Fast_GET_ITEM(val, 6));
+ m_conf.max_x = PyInt_AsLong( PySequence_Fast_GET_ITEM(fast, 0));
+ m_conf.max_y = PyInt_AsLong( PySequence_Fast_GET_ITEM(fast, 1));
+ m_conf.aspect_ratio = (double)PyInt_AsLong( PySequence_Fast_GET_ITEM(fast, 2)) / PyInt_AsLong(PySequence_Fast_GET_ITEM(fast, 3));
+ m_conf.usecache = PyInt_AsLong( PySequence_Fast_GET_ITEM(fast, 4));
+ m_conf.resizetype = PyInt_AsLong( PySequence_Fast_GET_ITEM(fast, 5));
+ const char *bg_str = PyString_AsString( PySequence_Fast_GET_ITEM(fast, 6));
if(bg_str[0] == '#' && strlen(bg_str)==9)
{