""" Minimal, standalone crash test - completely independent of the Order Manager app. Run this directly: python minimal_crash_test.py Click "Open Dialog", then close it (X button or Cancel). If this crashes the same way (exit code -1073740791 / 0xC0000409), the issue is in your PyQt6 install/environment itself, not in anything specific to the Order Manager codebase - every fix attempt there has been chasing the wrong thing. """ import sys from PyQt6.QtWidgets import ( QApplication, QMainWindow, QPushButton, QDialog, QVBoxLayout, QLineEdit, QLabel, QDialogButtonBox, ) class MinimalDialog(QDialog): def __init__(self, parent=None): super().__init__(parent) self.setWindowTitle("Minimal Test Dialog") layout = QVBoxLayout(self) layout.addWidget(QLabel("Just a label and a text field.")) layout.addWidget(QLineEdit("1.00")) button_box = QDialogButtonBox() button_box.addButton("OK", QDialogButtonBox.ButtonRole.AcceptRole) button_box.addButton(QDialogButtonBox.StandardButton.Cancel) button_box.accepted.connect(self.accept) button_box.rejected.connect(self.reject) layout.addWidget(button_box) class MainWindow(QMainWindow): def __init__(self): super().__init__() self.setWindowTitle("Minimal Crash Test") self.resize(300, 100) button = QPushButton("Open Dialog") button.clicked.connect(self.open_dialog) self.setCentralWidget(button) def open_dialog(self): print("about to open dialog", flush=True) dialog = MinimalDialog(self) result = dialog.exec() print(f"dialog closed, result={result}", flush=True) if __name__ == "__main__": app = QApplication(sys.argv) window = MainWindow() window.show() sys.exit(app.exec())