fix(ui): guard project plan cleanup after qt child deletion

This commit is contained in:
阿白叔 committed 2026-11-01 22:53:59 +08:00
1 parent 8b8d2beefe
commit 51597ad9fc
3 files changed
+34

No files matched your search

@@ -10,6 +10,7 @@ from PySide6.QtGui import QAction,QKeySequence
from PySide6.QtWidgets import (QDialog, QDialogButtonBox, QFileDialog, QHBoxLayout, QLabel,
QLineEdit, QListWidget, QListWidgetItem, QMessageBox, QPushButton,
QVBoxLayout, QWidget, QToolButton, QMenu)
from shiboken6 import isValid
from .detail_windows import BomReportDialog
from .target_table import TargetTable
@@ -669,6 +670,11 @@ class ProjectPlanPanel(QWidget):
self.report_toggle.setChecked(False)
def _restore_bom_report(self, scope):
# Qt may reclaim an owned control while the parent window is already
# closing. Cleanup still needs to release the in-memory preview, but
# must not call into a dead C++ wrapper.
if not isValid(self) or not isValid(self.report_toggle):
return
machine = self._bom_imports.get(scope)
state = machine.state if machine is not None else BomImportState()
self.last_bom_report = state.report