aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>2006-12-12 19:36:32 +0000
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>2006-12-12 19:36:32 +0000
commit93236223dac3af2ee2b4b40b07d4128bff8ea653 (patch)
treeffed72050100b7e977ec6adb4db1798ed9d365d1
parent86b04511f9dc9f11465b68159f5547a124d1c4d0 (diff)
downloadenigma2-93236223dac3af2ee2b4b40b07d4128bff8ea653.tar.gz
enigma2-93236223dac3af2ee2b4b40b07d4128bff8ea653.zip
fix bug in mainloop (this fixes sometimes no more responding e2)
-rw-r--r--lib/base/ebase.cpp16
-rw-r--r--lib/base/ebase.h2
2 files changed, 15 insertions, 3 deletions
diff --git a/lib/base/ebase.cpp b/lib/base/ebase.cpp
index 480c8ea8..e5168096 100644
--- a/lib/base/ebase.cpp
+++ b/lib/base/ebase.cpp
@@ -118,7 +118,8 @@ void eMainloop::addSocketNotifier(eSocketNotifier *sn)
{
int fd = sn->getFD();
ASSERT(notifiers.find(fd) == notifiers.end());
- notifiers[fd]=sn;
+ ASSERT(new_notifiers.find(fd) == new_notifiers.end());
+ new_notifiers[fd]=sn;
}
void eMainloop::removeSocketNotifier(eSocketNotifier *sn)
@@ -128,6 +129,11 @@ void eMainloop::removeSocketNotifier(eSocketNotifier *sn)
++i)
if (i->second == sn)
return notifiers.erase(i);
+ for (std::map<int,eSocketNotifier*>::iterator i = new_notifiers.find(sn->getFD());
+ i != new_notifiers.end();
+ ++i)
+ if (i->second == sn)
+ return new_notifiers.erase(i);
eFatal("removed socket notifier which is not present");
}
@@ -164,7 +170,13 @@ int eMainloop::processOneEvent(unsigned int user_timeout, PyObject **res, ePyObj
poll_timeout = user_timeout;
return_reason = 1;
}
-
+
+ for (std::map<int, eSocketNotifier*>::iterator it(new_notifiers.begin()); it != new_notifiers.end();)
+ {
+ notifiers[it->first]=it->second;
+ new_notifiers.erase(it++);
+ }
+
int nativecount=notifiers.size(),
fdcount=nativecount,
ret=0;
diff --git a/lib/base/ebase.h b/lib/base/ebase.h
index a399667e..db936794 100644
--- a/lib/base/ebase.h
+++ b/lib/base/ebase.h
@@ -175,7 +175,7 @@ class eMainloop
{
friend class eTimer;
friend class eSocketNotifier;
- std::map<int, eSocketNotifier*> notifiers;
+ std::map<int, eSocketNotifier*> notifiers, new_notifiers;
ePtrList<eTimer> m_timer_list;
bool app_quit_now;
int loop_level;