From 5190765ce16ccf1b8b544bcf916a6629ce1498d7 Mon Sep 17 00:00:00 2001 From: Jan Date: Sat, 16 Dec 2023 03:07:54 +0100 Subject: Call plugin unload function after stopping event loop (#539) This can prevent race conditions where unload is clearing data but main is still working with it --- backend/decky_loader/plugin/sandboxed_plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/decky_loader/plugin/sandboxed_plugin.py b/backend/decky_loader/plugin/sandboxed_plugin.py index 6be97b4a..1c3c5bd2 100644 --- a/backend/decky_loader/plugin/sandboxed_plugin.py +++ b/backend/decky_loader/plugin/sandboxed_plugin.py @@ -115,11 +115,11 @@ class SandboxedPlugin: if "stop" in data: self.log.info("Calling Loader unload function.") - await self._unload() get_event_loop().stop() while get_event_loop().is_running(): await sleep(0) get_event_loop().close() + await self._unload() raise Exception("Closing message listener") d: SocketResponseDict = {"res": None, "success": True, "id": data["id"]} -- cgit v1.2.3