Merge pull request #382 from skyedeving/fix-more-leaks

Fixing more leaks from orphaned QWidgets
This commit is contained in:
oldmud0 2021-01-08 11:00:12 -06:00 committed by GitHub
commit b36263934c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 8 deletions

View File

@ -41,7 +41,7 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app)
// Let's add the tabs one by one. // Let's add the tabs one by one.
// First, we'll start with 'Gameplay'. // First, we'll start with 'Gameplay'.
ui_gameplay_tab = new QWidget(); ui_gameplay_tab = new QWidget(this);
ui_gameplay_tab->setSizePolicy(sizePolicy1); ui_gameplay_tab->setSizePolicy(sizePolicy1);
ui_settings_tabs->addTab(ui_gameplay_tab, tr("Gameplay")); ui_settings_tabs->addTab(ui_gameplay_tab, tr("Gameplay"));
ui_form_layout_widget = new QWidget(ui_gameplay_tab); 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); 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); scroll->setWidget(ui_form_layout_widget);
ui_gameplay_tab->setLayout(new QVBoxLayout); ui_gameplay_tab->setLayout(new QVBoxLayout);
ui_gameplay_tab->layout()->addWidget(scroll); ui_gameplay_tab->layout()->addWidget(scroll);
ui_gameplay_tab->show(); ui_gameplay_tab->show();
// Here we start the callwords tab. // 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_settings_tabs->addTab(ui_callwords_tab, tr("Callwords"));
ui_callwords_widget = new QWidget(ui_callwords_tab); 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); ui_callwords_layout->addWidget(ui_callwords_explain_lbl);
// The audio tab. // The audio tab.
ui_audio_tab = new QWidget(); ui_audio_tab = new QWidget(this);
ui_settings_tabs->addTab(ui_audio_tab, tr("Audio")); ui_settings_tabs->addTab(ui_audio_tab, tr("Audio"));
ui_audio_widget = new QWidget(ui_audio_tab); 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); ui_audio_layout->setWidget(row, QFormLayout::FieldRole, ui_objectmusic_cb);
// The casing tab! // The casing tab!
ui_casing_tab = new QWidget(); ui_casing_tab = new QWidget(this);
ui_settings_tabs->addTab(ui_casing_tab, tr("Casing")); ui_settings_tabs->addTab(ui_casing_tab, tr("Casing"));
ui_casing_widget = new QWidget(ui_casing_tab); ui_casing_widget = new QWidget(ui_casing_tab);

View File

@ -9,6 +9,7 @@ void call_error(QString p_message)
{ {
QMessageBox *msgBox = new QMessageBox; QMessageBox *msgBox = new QMessageBox;
msgBox->setAttribute(Qt::WA_DeleteOnClose);
msgBox->setText(QCoreApplication::translate("debug_functions", "Error: %1") msgBox->setText(QCoreApplication::translate("debug_functions", "Error: %1")
.arg(p_message)); .arg(p_message));
msgBox->setWindowTitle( msgBox->setWindowTitle(
@ -22,6 +23,7 @@ void call_notice(QString p_message)
{ {
QMessageBox *msgBox = new QMessageBox; QMessageBox *msgBox = new QMessageBox;
msgBox->setAttribute(Qt::WA_DeleteOnClose);
msgBox->setText(p_message); msgBox->setText(p_message);
msgBox->setWindowTitle( msgBox->setWindowTitle(
QCoreApplication::translate("debug_functions", "Notice")); QCoreApplication::translate("debug_functions", "Notice"));

View File

@ -258,8 +258,9 @@ void Courtroom::set_evidence_list(QVector<evi_type> &p_evi_list)
else if (compare_evidence_changed( else if (compare_evidence_changed(
old_list.at(current_evidence), old_list.at(current_evidence),
local_evidence_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->setText(tr("The piece of evidence you've been editing has changed."));
msgBox->setInformativeText(tr("Do you wish to keep your changes?")); msgBox->setInformativeText(tr("Do you wish to keep your changes?"));
msgBox->setDetailedText(tr( msgBox->setDetailedText(tr(
@ -552,7 +553,8 @@ void Courtroom::on_evidence_x_clicked()
evidence_close(); evidence_close();
return; return;
} }
QMessageBox *msgBox = new QMessageBox; QMessageBox *msgBox = new QMessageBox(this);
msgBox->setAttribute(Qt::WA_DeleteOnClose);
msgBox->setText(tr("Evidence has been modified.")); msgBox->setText(tr("Evidence has been modified."));
msgBox->setInformativeText(tr("Do you want to save your changes?")); msgBox->setInformativeText(tr("Do you want to save your changes?"));
msgBox->setStandardButtons(QMessageBox::Save | QMessageBox::Discard | msgBox->setStandardButtons(QMessageBox::Save | QMessageBox::Discard |
@ -655,7 +657,8 @@ void Courtroom::on_evidence_transfer_clicked()
private_evidence_list.append(f_evi); 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->setText(tr("\"%1\" has been transferred.").arg(name));
msgBox->setStandardButtons(QMessageBox::Ok); msgBox->setStandardButtons(QMessageBox::Ok);
msgBox->setDefaultButton(QMessageBox::Ok); msgBox->setDefaultButton(QMessageBox::Ok);