diff options
| author | Carl Hetherington <cth@carlh.net> | 2023-01-13 13:57:28 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2023-01-14 00:42:39 +0100 |
| commit | b7e65adf286ce20918797a06a910ededf8f07b7b (patch) | |
| tree | 5ae7d4b521cedc75feef7b1a03b86b2e058795ad /src/wx/screen_dialog.cc | |
| parent | e002d31ac51e80bb1d008c198b864dfcb2b30cb3 (diff) | |
Use more ScopeGuards.
Diffstat (limited to 'src/wx/screen_dialog.cc')
| -rw-r--r-- | src/wx/screen_dialog.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/wx/screen_dialog.cc b/src/wx/screen_dialog.cc index 1f1fc2fad..6d7fb4f03 100644 --- a/src/wx/screen_dialog.cc +++ b/src/wx/screen_dialog.cc @@ -272,12 +272,12 @@ ScreenDialog::get_recipient_from_file () void ScreenDialog::download_recipient () { - auto d = new DownloadCertificateDialog (this); - if (d->ShowModal() == wxID_OK) { - set_recipient (d->certificate()); - checked_set (_recipient_file, d->url()); + auto dialog = new DownloadCertificateDialog (this); + ScopeGuard sg = [dialog]() { dialog->Destroy(); }; + if (dialog->ShowModal() == wxID_OK) { + set_recipient(dialog->certificate()); + checked_set(_recipient_file, dialog->url()); } - d->Destroy (); setup_sensitivity (); } |
