Re-add EventManager check to prevent _call() outside main thread

This commit is contained in:
jesopo 2019-06-26 11:42:23 +01:00
parent d2a1763dc8
commit 4bf5c4783b

View file

@ -142,6 +142,9 @@ class EventRoot(object):
def _call(self, path: typing.List[str], kwargs: dict, safe: bool, def _call(self, path: typing.List[str], kwargs: dict, safe: bool,
context: typing.Optional[str], maximum: typing.Optional[int] context: typing.Optional[str], maximum: typing.Optional[int]
) -> typing.List[typing.Any]: ) -> typing.List[typing.Any]:
if not utils.is_main_thread():
raise RuntimeError("Can't call events outside of main thread")
returns: typing.List[typing.Any] = [] returns: typing.List[typing.Any] = []
path_str = self._path_str(path) path_str = self._path_str(path)
if not path_str in self._hooks: if not path_str in self._hooks: