kivy/kivy — pull request #2072 by matham (2014-04-12 02:27:48+00:00)
Title: Only execute events that have not been removed.

This moves up the check as to whether an event exists to before the event is ticked. In order to not have to recheck whether the event was removed during the tick, we cache the current event being ticked in a clock variable so that if it's removed during the tick, the variable is set to `None` and we don't remove it again.

This way we save ourselves having to check whether the event has been removed, both before and after the tick. It also ensures that events removed are never called as long as the event is removed anytime before the event is ticked.

Fixes #2068.