Skip to content

Commit af6d532

Browse files
committed
qt, refactor: Allocate SendConfirmationDialog instances on heap
This change is require for the next commit.
1 parent 8be5853 commit af6d532

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/qt/sendcoinsdialog.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -388,9 +388,10 @@ void SendCoinsDialog::sendButtonClicked([[maybe_unused]] bool checked)
388388

389389
const QString confirmation = model->wallet().privateKeysDisabled() ? tr("Confirm transaction proposal") : tr("Confirm send coins");
390390
const QString confirmButtonText = model->wallet().privateKeysDisabled() ? tr("Create Unsigned") : tr("Send");
391-
SendConfirmationDialog confirmationDialog(confirmation, question_string, informative_text, detailed_text, SEND_CONFIRM_DELAY, confirmButtonText, this);
392-
confirmationDialog.exec();
393-
QMessageBox::StandardButton retval = static_cast<QMessageBox::StandardButton>(confirmationDialog.result());
391+
auto confirmationDialog = new SendConfirmationDialog(confirmation, question_string, informative_text, detailed_text, SEND_CONFIRM_DELAY, confirmButtonText, this);
392+
confirmationDialog->setAttribute(Qt::WA_DeleteOnClose);
393+
// TODO: Replace QDialog::exec() with safer QDialog::open().
394+
const auto retval = static_cast<QMessageBox::StandardButton>(confirmationDialog->exec());
394395

395396
if(retval != QMessageBox::Yes)
396397
{

src/qt/walletmodel.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -525,9 +525,10 @@ bool WalletModel::bumpFee(uint256 hash, uint256& new_hash)
525525
questionString.append(tr("Warning: This may pay the additional fee by reducing change outputs or adding inputs, when necessary. It may add a new change output if one does not already exist. These changes may potentially leak privacy."));
526526
}
527527

528-
SendConfirmationDialog confirmationDialog(tr("Confirm fee bump"), questionString);
529-
confirmationDialog.exec();
530-
QMessageBox::StandardButton retval = static_cast<QMessageBox::StandardButton>(confirmationDialog.result());
528+
auto confirmationDialog = new SendConfirmationDialog(tr("Confirm fee bump"), questionString);
529+
confirmationDialog->setAttribute(Qt::WA_DeleteOnClose);
530+
// TODO: Replace QDialog::exec() with safer QDialog::open().
531+
const auto retval = static_cast<QMessageBox::StandardButton>(confirmationDialog->exec());
531532

532533
// cancel sign&broadcast if user doesn't want to bump the fee
533534
if (retval != QMessageBox::Yes) {

0 commit comments

Comments
 (0)