mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
Engine-plugins wouldn't always close.
... because the code to terminate them wasn't always called. Especially annoying on Windows, since the sub-program could aparently become a zomboid after termination of the main one(s). I guess this is still part of the still open CURA-10475 'branch' in a way? There is no other ticket that fits at the moment.
This commit is contained in:
parent
70e858ecb6
commit
015e635213
1 changed files with 18 additions and 5 deletions
|
@ -200,14 +200,23 @@ class CuraEngineBackend(QObject, Backend):
|
|||
It assigns unique ports to each plugin to avoid conflicts.
|
||||
:return:
|
||||
"""
|
||||
self.stopPlugins()
|
||||
backend_plugins = CuraApplication.getInstance().getBackendPlugins()
|
||||
for backend_plugin in backend_plugins:
|
||||
# Set the port to prevent plugins from using the same one.
|
||||
if backend_plugin.getPort() < 1:
|
||||
backend_plugin.setPort(self._last_backend_plugin_port)
|
||||
self._last_backend_plugin_port += 1
|
||||
backend_plugin.start()
|
||||
|
||||
def stopPlugins(self) -> None:
|
||||
"""
|
||||
Ensure that all backend plugins will be terminated.
|
||||
"""
|
||||
backend_plugins = CuraApplication.getInstance().getBackendPlugins()
|
||||
for backend_plugin in backend_plugins:
|
||||
if backend_plugin.isRunning():
|
||||
backend_plugin.stop()
|
||||
# Set the port to prevent plugins from using the same one.
|
||||
backend_plugin.setPort(self._last_backend_plugin_port)
|
||||
self._last_backend_plugin_port += 1
|
||||
backend_plugin.start()
|
||||
|
||||
def _resetLastSliceTimeStats(self) -> None:
|
||||
self._time_start_process = None
|
||||
|
@ -396,6 +405,8 @@ class CuraEngineBackend(QObject, Backend):
|
|||
if self._start_slice_job is not None:
|
||||
self._start_slice_job.cancel()
|
||||
|
||||
self.stopPlugins()
|
||||
|
||||
self.slicingCancelled.emit()
|
||||
self.processingProgress.emit(0)
|
||||
Logger.log("d", "Attempting to kill the engine process")
|
||||
|
@ -795,6 +806,8 @@ class CuraEngineBackend(QObject, Backend):
|
|||
:param message: The protobuf message signalling that slicing is finished.
|
||||
"""
|
||||
|
||||
self.stopPlugins()
|
||||
|
||||
self.setState(BackendState.Done)
|
||||
self.processingProgress.emit(1.0)
|
||||
self._time_end_slice = time()
|
||||
|
@ -1009,7 +1022,6 @@ class CuraEngineBackend(QObject, Backend):
|
|||
|
||||
We should reset our state and start listening for new connections.
|
||||
"""
|
||||
|
||||
if not self._restart:
|
||||
if self._process: # type: ignore
|
||||
return_code = self._process.wait()
|
||||
|
@ -1020,6 +1032,7 @@ class CuraEngineBackend(QObject, Backend):
|
|||
self.stopSlicing()
|
||||
else:
|
||||
Logger.log("d", "Backend finished slicing. Resetting process and socket.")
|
||||
self.stopPlugins()
|
||||
self._process = None # type: ignore
|
||||
|
||||
def _reportBackendError(self, _message_id: str, _action_id: str) -> None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue