From 2effe2ed03cebfd11746b1131eef3dd59205cfaf Mon Sep 17 00:00:00 2001 From: Matt Einhorn Date: Thu, 24 Feb 2022 13:35:47 -0500 Subject: [PATCH] Track whether the clock has started. (#7810) --- kivy/_clock.pxd | 1 + kivy/_clock.pyx | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/kivy/_clock.pxd b/kivy/_clock.pxd index d065583f6..6dd96ba3f 100644 --- a/kivy/_clock.pxd +++ b/kivy/_clock.pxd @@ -95,6 +95,7 @@ cdef class CyClockBase(object): cdef public object _lock_acquire cdef public object _lock_release + cdef public int has_started cdef public int has_ended cdef public object _del_safe_lock cdef public int _del_safe_done diff --git a/kivy/_clock.pyx b/kivy/_clock.pyx index 6739d7ec1..450699bf1 100644 --- a/kivy/_clock.pyx +++ b/kivy/_clock.pyx @@ -260,6 +260,7 @@ cdef class CyClockBase(object): self._del_safe_lock = RLock() self._del_safe_done = False self.has_ended = False + self.has_started = False def start_clock(self): """Must be called to start the clock. @@ -268,7 +269,10 @@ cdef class CyClockBase(object): """ self._lock_acquire() try: - pass + if self.has_started: + return + + self.has_started = True # for now don't raise an exception when restarting because kivy's # graphical tests are not setup to handle clock isolation so they try # to restart the clock