summaryrefslogtreecommitdiff
path: root/src/wx/screen_dialog.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2023-01-14 22:06:05 +0100
committerCarl Hetherington <cth@carlh.net>2023-01-14 22:06:05 +0100
commit4e4968464eeef1956cb82392e1fc3b27a792ab89 (patch)
tree79db245f320df21a075a0fd26de685e02fff6924 /src/wx/screen_dialog.cc
parent0ecea9f4d1a772e99f396e47364e68abfbfe9f7f (diff)
Add wx_ptr and use it instead of ScopeGuard in a lot of places.
Diffstat (limited to 'src/wx/screen_dialog.cc')
-rw-r--r--src/wx/screen_dialog.cc10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/wx/screen_dialog.cc b/src/wx/screen_dialog.cc
index 6d7fb4f03..3fa17353d 100644
--- a/src/wx/screen_dialog.cc
+++ b/src/wx/screen_dialog.cc
@@ -25,6 +25,7 @@
#include "screen_dialog.h"
#include "static_text.h"
#include "table_dialog.h"
+#include "wx_ptr.h"
#include "wx_util.h"
#include "lib/compose.hpp"
#include "lib/scope_guard.h"
@@ -64,8 +65,7 @@ public:
void load_certificate ()
{
- auto dialog = new FileDialog(this, _("Trusted Device certificate"), wxEmptyString, wxFD_DEFAULT_STYLE, "SelectCertificatePath");
- ScopeGuard sg = [dialog]() { dialog->Destroy(); };
+ auto dialog = make_wx<FileDialog>(this, _("Trusted Device certificate"), wxEmptyString, wxFD_DEFAULT_STYLE, "SelectCertificatePath");
if (!dialog->show()) {
return;
}
@@ -259,8 +259,7 @@ ScreenDialog::load_recipient (boost::filesystem::path file)
void
ScreenDialog::get_recipient_from_file ()
{
- auto dialog = new FileDialog(this, _("Select Certificate File"), wxEmptyString, wxFD_DEFAULT_STYLE , "SelectCertificatePath");
- ScopeGuard sg = [dialog]() { dialog->Destroy(); };
+ auto dialog = make_wx<FileDialog>(this, _("Select Certificate File"), wxEmptyString, wxFD_DEFAULT_STYLE , "SelectCertificatePath");
if (dialog->show()) {
load_recipient(dialog->paths()[0]);
}
@@ -272,8 +271,7 @@ ScreenDialog::get_recipient_from_file ()
void
ScreenDialog::download_recipient ()
{
- auto dialog = new DownloadCertificateDialog (this);
- ScopeGuard sg = [dialog]() { dialog->Destroy(); };
+ auto dialog = make_wx<DownloadCertificateDialog>(this);
if (dialog->ShowModal() == wxID_OK) {
set_recipient(dialog->certificate());
checked_set(_recipient_file, dialog->url());