Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/cura
diff options
context:
space:
mode:
authorRemco Burema <r.burema@ultimaker.com>2022-04-19 15:28:41 +0300
committerRemco Burema <r.burema@ultimaker.com>2022-04-19 15:28:41 +0300
commit5a43e5945c27e77d389a46bff9cd9ccc18ec6f14 (patch)
tree6d637c5e3cd60879405560866110b0040abf4715 /cura
parent1e1b4f3dac5435009fb54a6104f7d0422fdd049e (diff)
Fix Cura not closing properly on Windows.
May be a bit crude, but simple and readable, and we're supposed to have handled everything anyway at the point the event comes in. CURA-9155
Diffstat (limited to 'cura')
-rwxr-xr-xcura/CuraApplication.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py
index aead7d8a4e..a242aa5363 100755
--- a/cura/CuraApplication.py
+++ b/cura/CuraApplication.py
@@ -8,7 +8,7 @@ import time
from typing import cast, TYPE_CHECKING, Optional, Callable, List, Any, Dict
import numpy
-from PyQt6.QtCore import QObject, QTimer, QUrl, pyqtSignal, pyqtProperty, QEvent, pyqtEnum
+from PyQt6.QtCore import QObject, QTimer, QUrl, pyqtSignal, pyqtProperty, QEvent, pyqtEnum, QCoreApplication
from PyQt6.QtGui import QColor, QIcon
from PyQt6.QtQml import qmlRegisterUncreatableType, qmlRegisterUncreatableMetaObject, qmlRegisterSingletonType, qmlRegisterType
from PyQt6.QtWidgets import QMessageBox
@@ -122,7 +122,6 @@ if TYPE_CHECKING:
numpy.seterr(all = "ignore")
-
class CuraApplication(QtApplication):
# SettingVersion represents the set of settings available in the machine/extruder definitions.
# You need to make sure that this version number needs to be increased if there is any non-backwards-compatible
@@ -623,11 +622,14 @@ class CuraApplication(QtApplication):
# the QML code then gets `null` as the global stack and can deal with that as it deems fit.
self.getMachineManager().setActiveMachine(None)
+ QtApplication.getInstance().closeAllWindows()
+
main_window = self.getMainWindow()
if main_window is not None:
main_window.close()
- else:
- self.exit(0)
+
+ QtApplication.closeAllWindows()
+ QCoreApplication.quit()
# This function first performs all upon-exit checks such as USB printing that is in progress.
# Use this to close the application.
@@ -1098,6 +1100,12 @@ class CuraApplication(QtApplication):
else:
self._open_file_queue.append(event.file())
+ if int(event.type()) == 20: # 'QEvent.Type.Quit' enum isn't there, even though it should be according to docs.
+ # Once we're at this point, everything should have been flushed already (past OnExitCallbackManager).
+ # It's more difficult to call sys.exit(0): That requires that it happens as the result of a pyqtSignal-emit.
+ # (See https://doc.qt.io/qt-6/qcoreapplication.html#quit)
+ os._exit(0)
+
return super().event(event)
def getAutoSave(self) -> Optional[AutoSave]: