diff options
| author | Carl Hetherington <cth@carlh.net> | 2023-01-27 13:41:49 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2023-01-27 13:41:49 +0100 |
| commit | 7aab34abcab28ca38a5354dec075b56d430e82db (patch) | |
| tree | a7a02355bb4ea08cdf652ccb89b4ee6d1247b5dd /src/wx/templates_dialog.cc | |
| parent | 526829ad670c19d5466555890d8afe8d7f744834 (diff) | |
More stack-allocated Dialog objects.
Diffstat (limited to 'src/wx/templates_dialog.cc')
| -rw-r--r-- | src/wx/templates_dialog.cc | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/wx/templates_dialog.cc b/src/wx/templates_dialog.cc index 3336277b6..145e4f2b9 100644 --- a/src/wx/templates_dialog.cc +++ b/src/wx/templates_dialog.cc @@ -130,17 +130,18 @@ TemplatesDialog::rename_clicked () li.m_mask = wxLIST_MASK_TEXT; _list->GetItem (li); - auto d = new RenameTemplateDialog (this); - d->set (li.m_text); - if (d->ShowModal() == wxID_OK) { - if (!d->get().IsEmpty()) { - Config::instance()->rename_template (wx_to_std (li.m_text), wx_to_std (d->get ())); - _list->SetItem (item, 0, d->get()); - } else { - error_dialog (this, _("Template names must not be empty.")); - } + RenameTemplateDialog dialog(this); + dialog.set(li.m_text); + if (dialog.ShowModal() != wxID_OK) { + return; + } + + if (!dialog.get().IsEmpty()) { + Config::instance()->rename_template(wx_to_std(li.m_text), wx_to_std(dialog.get())); + _list->SetItem(item, 0, dialog.get()); + } else { + error_dialog (this, _("Template names must not be empty.")); } - d->Destroy (); } |
