summaryrefslogtreecommitdiff
path: root/src/wx/fonts_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/fonts_dialog.cc
parent0ecea9f4d1a772e99f396e47364e68abfbfe9f7f (diff)
Add wx_ptr and use it instead of ScopeGuard in a lot of places.
Diffstat (limited to 'src/wx/fonts_dialog.cc')
-rw-r--r--src/wx/fonts_dialog.cc7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/wx/fonts_dialog.cc b/src/wx/fonts_dialog.cc
index b21bb8498..9e38e9e68 100644
--- a/src/wx/fonts_dialog.cc
+++ b/src/wx/fonts_dialog.cc
@@ -22,6 +22,7 @@
#include "dcpomatic_button.h"
#include "fonts_dialog.h"
#include "system_font_dialog.h"
+#include "wx_ptr.h"
#include "wx_util.h"
#include "lib/content.h"
#include "lib/font.h"
@@ -184,8 +185,7 @@ FontsDialog::set_from_file_clicked ()
default_dir = "/System/Library/Fonts";
#endif
- auto d = new wxFileDialog (this, _("Choose a font file"), default_dir, wxT(""), wxT("*.ttf;*.otf;*.ttc"), wxFD_CHANGE_DIR);
- ScopeGuard sg = [d]() { d->Destroy(); };
+ auto d = make_wx<wxFileDialog>(this, _("Choose a font file"), default_dir, wxT(""), wxT("*.ttf;*.otf;*.ttc"), wxFD_CHANGE_DIR);
if (d->ShowModal() != wxID_OK) {
return;
@@ -204,8 +204,7 @@ FontsDialog::set_from_system_font_clicked()
return;
}
- auto dialog = new SystemFontDialog(this);
- ScopeGuard sg = [dialog]() { dialog->Destroy(); };
+ auto dialog = make_wx<SystemFontDialog>(this);
if (dialog->ShowModal() == wxID_OK) {
auto font_file = dialog->get_font();
if (font_file) {