diff options
author | Ghostkeeper <rubend@tutanota.com> | 2020-04-23 12:38:27 +0300 |
---|---|---|
committer | Ghostkeeper <rubend@tutanota.com> | 2020-04-23 12:38:27 +0300 |
commit | add9be387ba27fab3f5b23effc29b6ccd2158e55 (patch) | |
tree | d5172e826142c0e691cf3c7c969ed30015cc4324 /plugins/CuraEngineBackend | |
parent | d9cdea9496f340095861eb406e33f9442a53a2d2 (diff) |
Fix crash when creating a socket before the plug-in is fully registered
The plug-in ID is set once the register function is completed, so after initialisation. If the _createSocket function is called in between, Cura would crash.
I don't know why the _createSocket function would be called in between, but possibly another plug-in causes an event that calls it since it's being called on many events (everything that would initiate a reslice).
Fixes Sentry issue CURA-K4.
Diffstat (limited to 'plugins/CuraEngineBackend')
-rwxr-xr-x | plugins/CuraEngineBackend/CuraEngineBackend.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/plugins/CuraEngineBackend/CuraEngineBackend.py b/plugins/CuraEngineBackend/CuraEngineBackend.py index 3dd0589865..6a8a4a7347 100755 --- a/plugins/CuraEngineBackend/CuraEngineBackend.py +++ b/plugins/CuraEngineBackend/CuraEngineBackend.py @@ -720,9 +720,12 @@ class CuraEngineBackend(QObject, Backend): ## Creates a new socket connection. def _createSocket(self, protocol_file: str = None) -> None: if not protocol_file: + if not self.getPluginId(): + Logger.error("Can't create socket before CuraEngineBackend plug-in is registered.") + return plugin_path = PluginRegistry.getInstance().getPluginPath(self.getPluginId()) if not plugin_path: - Logger.log("e", "Could not get plugin path!", self.getPluginId()) + Logger.error("Could not get plugin path!", self.getPluginId()) return protocol_file = os.path.abspath(os.path.join(plugin_path, "Cura.proto")) super()._createSocket(protocol_file) |