fix(ALMainWindow): optimize the resource usage of gui

This commit fixes memory management issues in the
ALMainWindow class where config window and
task threads were not properly deleted after use,
leading to continuously increasing memory usage.

The fix ensures that all GUI components are
deleted after close and background threads are
correctly terminated.
This commit is contained in:
KenanZhu committed 2025-11-11 09:05:55 +08:00
1 parent 68b61b5c8c
commit 389ac885d3
1 file changed
+7 -1
+7 -1
View File
@@ -242,6 +242,8 @@ class ALMainWindow(QMainWindow, Ui_ALMainWindow):
config_paths: dict
):
self.__alConfigWidget.configWidgetCloseSingal.disconnect(self.onConfigWidgetClosed)
self.__alConfigWidget.deleteLater()
self.__alConfigWidget = None
self.ConfigButton.setEnabled(True)
self.StartButton.setEnabled(True)
@@ -288,8 +290,12 @@ class ALMainWindow(QMainWindow, Ui_ALMainWindow):
):
if self.__auto_lib_thread and self.__auto_lib_thread.isRunning():
self.__auto_lib_thread.stop()
self.showTrace("正在停止操作......")
self.__auto_lib_thread.stop()
self.__auto_lib_thread.wait()
self.showTrace("操作已停止")
self.__auto_lib_thread.finishedSignal.disconnect(self.onStopButtonClicked)
self.__auto_lib_thread.deleteLater()
self.setControlButtons(True, True, False)
@Slot()