mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-04 08:22:32 +00:00
Fix crash if the Help dialog was opened a second time
If it's closed with the top right close button instead of clicking the Help button again, a required flag wasn't reset, making the next click on Help try to close a nonexistent window and segfault
This commit is contained in:
parent
216a5dcbc2
commit
195ef4c02f
@ -144,7 +144,7 @@ bool isHelpOpen = false;
|
||||
HelpDialog* helpDialog;
|
||||
void EditorDialog::onHelpClicked() {
|
||||
if (!isHelpOpen) {
|
||||
helpDialog = new HelpDialog(this);
|
||||
helpDialog = new HelpDialog(&isHelpOpen, this);
|
||||
helpDialog->setWindowTitle("Help");
|
||||
helpDialog->setAttribute(Qt::WA_DeleteOnClose); // Clean up on close
|
||||
// Get the position and size of the Config window
|
||||
|
@ -58,7 +58,13 @@ ExpandableSection::ExpandableSection(const QString& title, const QString& conten
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
HelpDialog::HelpDialog(QWidget* parent) : QDialog(parent) {
|
||||
void HelpDialog::closeEvent(QCloseEvent* event) {
|
||||
*help_open_ptr = false;
|
||||
close();
|
||||
}
|
||||
|
||||
HelpDialog::HelpDialog(bool* open_flag, QWidget* parent) : QDialog(parent) {
|
||||
help_open_ptr = open_flag;
|
||||
// Main layout for the help dialog
|
||||
QVBoxLayout* mainLayout = new QVBoxLayout(this);
|
||||
|
||||
|
@ -33,9 +33,14 @@ private:
|
||||
class HelpDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit HelpDialog(QWidget* parent = nullptr);
|
||||
explicit HelpDialog(bool* open_flag = nullptr, QWidget* parent = nullptr);
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent* event) override;
|
||||
|
||||
private:
|
||||
bool* help_open_ptr;
|
||||
|
||||
QString quickstart() {
|
||||
return
|
||||
R"(The keyboard remapping backend, GUI and documentation have been written by kalaposfos
|
||||
|
Loading…
Reference in New Issue
Block a user