Merge branch 'master' of git.opendreambox.org:/git/enigma2
authorFelix Domke <tmbinc@elitedvb.net>
Tue, 18 Nov 2008 21:21:59 +0000 (22:21 +0100)
committerFelix Domke <tmbinc@elitedvb.net>
Tue, 18 Nov 2008 21:21:59 +0000 (22:21 +0100)
lib/base/ebase.cpp
lib/base/ebase.h
lib/gdi/picload.cpp

index bd2ec589227946199b60071faf4ab4617dc850ba..313732abd221fc27c30292b602ff1591b5ae5230 100644 (file)
@@ -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);
index 84845a952d588c03f679cd44658d32cbde14764f..524052bda4f9b723ec4208b342d98b29ae0f6605 100644 (file)
@@ -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);
        }
index 375f33fbed30195f2b474bd9820f004d848be1e5..0fafeabd9741c22117b27612e3d4d6a84a6d8e14 100644 (file)
@@ -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)
                {