From 3eac36d0f54959b9708bfdabac490a38255255e5 Mon Sep 17 00:00:00 2001 From: jesopo Date: Sat, 22 Jun 2019 12:21:44 +0100 Subject: [PATCH] Restrict EventManager calls to the main thread --- src/EventManager.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/EventManager.py b/src/EventManager.py index 52e9a517..dd04b370 100644 --- a/src/EventManager.py +++ b/src/EventManager.py @@ -192,6 +192,9 @@ class EventHook(object): def _call(self, kwargs: dict, safe: bool, maximum: typing.Optional[int] ) -> typing.List[typing.Any]: + if not utils.is_main_thread(): + raise RuntimeError("Can't call events outside of main thread") + event_path = self._get_path() hooks = self.get_hooks() returns = [] # type: typing.List[typing.Any]