fix: joystickstatuswindow: defer deletion of window upon close (#1229)

Defer deleting the window when it's closed until after the main loop has
run. This prevents a segfault when the window is closed for
controllers with accelerometers and gyroscopes, such as DualSense
controllers.

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross
2025-09-04 04:31:28 +08:00
committed by GitHub
parent ab27f581f0
commit 805a323cc5
2 changed files with 3 additions and 0 deletions

View File

@@ -302,6 +302,8 @@ JoystickStatusWindow::JoystickStatusWindow(InputDevice *joystick, QWidget *paren
connect(this, &JoystickStatusWindow::finished, this, &JoystickStatusWindow::restoreButtonStates);
}
void JoystickStatusWindow::reject() { this->deleteLater(); }
JoystickStatusWindow::~JoystickStatusWindow() { delete ui; }
void JoystickStatusWindow::restoreButtonStates(int code)

View File

@@ -44,6 +44,7 @@ class JoystickStatusWindow : public QDialog
InputDevice *getJoystick() const;
private:
void reject();
Ui::JoystickStatusWindow *ui;
InputDevice *joystick;