Check that objects still exist when dispatching events to them
authorMikko Rasa <tdb@tdb.fi>
Fri, 27 Sep 2019 19:36:09 +0000 (22:36 +0300)
committerMikko Rasa <tdb@tdb.fi>
Fri, 27 Sep 2019 23:33:46 +0000 (02:33 +0300)
source/io/eventdispatcher.cpp

index f98474c227d4cc7e1fd8d1a2e03274a6f21c89d5..49b28ac78bf436997f74d2d8fecb740aebf47fb5 100644 (file)
@@ -65,7 +65,8 @@ void EventDispatcher::dispatch()
 {
        const vector<Poller::PolledObject> &result = poller.get_result();
        for(vector<Poller::PolledObject>::const_iterator i=result.begin(); i!=result.end(); ++i)
-               i->object->event(i->events);
+               if(objects.count(Slot(*this, *i->object)))
+                       i->object->event(i->events);
 }