diff options
| author | oldmud0 <oldmud0@users.noreply.github.com> | 2021-01-08 11:00:12 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-08 11:00:12 -0600 |
| commit | b36263934cc3d1ed911235df27744fc591be6a70 (patch) | |
| tree | 32af3c26aa7001794afc1c28471d066cfb4125ce | |
| parent | cbf8391a65a3f0dc7816b904261b3e38275ec063 (diff) | |
| parent | 512b7a37de7993eeca16e52ede74a7a07de4cd30 (diff) | |
Merge pull request #382 from skyedeving/fix-more-leaks
Fixing more leaks from orphaned QWidgets
| -rw-r--r-- | src/aooptionsdialog.cpp | 10 | ||||
| -rw-r--r-- | src/debug_functions.cpp | 2 | ||||
| -rw-r--r-- | src/evidence.cpp | 9 |
3 files changed, 13 insertions, 8 deletions
diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp index 2641d8d8..075e2d0f 100644 --- a/src/aooptionsdialog.cpp +++ b/src/aooptionsdialog.cpp @@ -41,7 +41,7 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) // Let's add the tabs one by one. // First, we'll start with 'Gameplay'. - ui_gameplay_tab = new QWidget(); + ui_gameplay_tab = new QWidget(this); ui_gameplay_tab->setSizePolicy(sizePolicy1); ui_settings_tabs->addTab(ui_gameplay_tab, tr("Gameplay")); ui_form_layout_widget = new QWidget(ui_gameplay_tab); @@ -372,14 +372,14 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_customchat_cb); - QScrollArea *scroll = new QScrollArea; + QScrollArea *scroll = new QScrollArea(this); scroll->setWidget(ui_form_layout_widget); ui_gameplay_tab->setLayout(new QVBoxLayout); ui_gameplay_tab->layout()->addWidget(scroll); ui_gameplay_tab->show(); // Here we start the callwords tab. - ui_callwords_tab = new QWidget(); + ui_callwords_tab = new QWidget(this); ui_settings_tabs->addTab(ui_callwords_tab, tr("Callwords")); ui_callwords_widget = new QWidget(ui_callwords_tab); @@ -416,7 +416,7 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) ui_callwords_layout->addWidget(ui_callwords_explain_lbl); // The audio tab. - ui_audio_tab = new QWidget(); + ui_audio_tab = new QWidget(this); ui_settings_tabs->addTab(ui_audio_tab, tr("Audio")); ui_audio_widget = new QWidget(ui_audio_tab); @@ -577,7 +577,7 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) ui_audio_layout->setWidget(row, QFormLayout::FieldRole, ui_objectmusic_cb); // The casing tab! - ui_casing_tab = new QWidget(); + ui_casing_tab = new QWidget(this); ui_settings_tabs->addTab(ui_casing_tab, tr("Casing")); ui_casing_widget = new QWidget(ui_casing_tab); diff --git a/src/debug_functions.cpp b/src/debug_functions.cpp index 477eec76..1613a7d1 100644 --- a/src/debug_functions.cpp +++ b/src/debug_functions.cpp @@ -9,6 +9,7 @@ void call_error(QString p_message) { QMessageBox *msgBox = new QMessageBox; + msgBox->setAttribute(Qt::WA_DeleteOnClose); msgBox->setText(QCoreApplication::translate("debug_functions", "Error: %1") .arg(p_message)); msgBox->setWindowTitle( @@ -22,6 +23,7 @@ void call_notice(QString p_message) { QMessageBox *msgBox = new QMessageBox; + msgBox->setAttribute(Qt::WA_DeleteOnClose); msgBox->setText(p_message); msgBox->setWindowTitle( QCoreApplication::translate("debug_functions", "Notice")); diff --git a/src/evidence.cpp b/src/evidence.cpp index a8f59135..b97607ba 100644 --- a/src/evidence.cpp +++ b/src/evidence.cpp @@ -258,8 +258,9 @@ void Courtroom::set_evidence_list(QVector<evi_type> &p_evi_list) else if (compare_evidence_changed( old_list.at(current_evidence), local_evidence_list.at(current_evidence))) { - QMessageBox *msgBox = new QMessageBox; + QMessageBox *msgBox = new QMessageBox(this); + msgBox->setAttribute(Qt::WA_DeleteOnClose); msgBox->setText(tr("The piece of evidence you've been editing has changed.")); msgBox->setInformativeText(tr("Do you wish to keep your changes?")); msgBox->setDetailedText(tr( @@ -552,7 +553,8 @@ void Courtroom::on_evidence_x_clicked() evidence_close(); return; } - QMessageBox *msgBox = new QMessageBox; + QMessageBox *msgBox = new QMessageBox(this); + msgBox->setAttribute(Qt::WA_DeleteOnClose); msgBox->setText(tr("Evidence has been modified.")); msgBox->setInformativeText(tr("Do you want to save your changes?")); msgBox->setStandardButtons(QMessageBox::Save | QMessageBox::Discard | @@ -655,7 +657,8 @@ void Courtroom::on_evidence_transfer_clicked() private_evidence_list.append(f_evi); } - QMessageBox *msgBox = new QMessageBox; + QMessageBox *msgBox = new QMessageBox(this); + msgBox->setAttribute(Qt::WA_DeleteOnClose); msgBox->setText(tr("\"%1\" has been transferred.").arg(name)); msgBox->setStandardButtons(QMessageBox::Ok); msgBox->setDefaultButton(QMessageBox::Ok); |
