fix(ui): guard destroyed windows and migrate stale workflow regressions

This commit is contained in:
阿白叔 committed 2026-10-19 16:27:35 +08:00
1 parent d12478efd8
commit e2f76c3387
10 files changed
+333 -1321

No files matched your search

@@ -1,6 +1,7 @@
"""Single-project task presentation; persistence and CAD remain in the service."""
from __future__ import annotations
from threading import Event
from shiboken6 import isValid
import time
from PySide6.QtCore import QElapsedTimer, QSettings, QSignalBlocker, QThreadPool, QTimer, Qt
from PySide6.QtWidgets import (QApplication, QDialog, QHBoxLayout, QMainWindow, QMessageBox,
@@ -717,7 +718,7 @@ class TrialTaskCenterWindow(QMainWindow):
self.plan_panel._summary()
operation_error = None
def valid():
return not self._closed and generation == self._generation and (retain_result or execution or expected_task_id is None or expected_task_id == self._task_id)
return isValid(self) and not self._closed and generation == self._generation and (retain_result or execution or expected_task_id is None or expected_task_id == self._task_id)
def succeeded(result):
nonlocal operation_error
if valid():
@@ -734,6 +735,8 @@ class TrialTaskCenterWindow(QMainWindow):
def failed(error):
nonlocal operation_error
operation_error = error
if not isValid(self) or self._closed:
return
self.operation_state = self.operation_state.finish(error)
if self._close_saving or not (isinstance(error, TaskCenterError) and error.code == 'operation_cancelled'):
self._close_pending = False
@@ -746,6 +749,8 @@ class TrialTaskCenterWindow(QMainWindow):
self._show_error(error, owner_task_id=owner)
def finished():
self._workers.discard(worker)
if not isValid(self) or self._closed:
return
self.plan_panel.finish_operation(error=operation_error)
self._close_saving = False
if self._close_pending and not self._closed: