summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-12-15 11:04:45 +0000
committerCarl Hetherington <cth@carlh.net>2014-12-15 11:04:45 +0000
commit328668a8b63fb407fd4e2fef1e253e992ab987ac (patch)
tree6468e9821f294867e2a6065c9740619b9b78aec3 /src
parentd7bffb968f0abd5c1e6d5e72e6ea70a701fe5d48 (diff)
Hand-apply 9e173bdda26f32a1da7afc38d5dcf8ed63e7d3cf; fix a few missing checks on the return value of ShowModal (#449).
Diffstat (limited to 'src')
-rw-r--r--src/wx/audio_panel.cc4
-rw-r--r--src/wx/kdm_dialog.cc45
2 files changed, 25 insertions, 24 deletions
diff --git a/src/wx/audio_panel.cc b/src/wx/audio_panel.cc
index a2de484c0..f1d832d86 100644
--- a/src/wx/audio_panel.cc
+++ b/src/wx/audio_panel.cc
@@ -178,9 +178,9 @@ void
AudioPanel::gain_calculate_button_clicked ()
{
GainCalculatorDialog* d = new GainCalculatorDialog (this);
- d->ShowModal ();
+ int const r = d->ShowModal ();
- if (d->wanted_fader() == 0 || d->actual_fader() == 0) {
+ if (r == wxID_CANCEL || d->wanted_fader() == 0 || d->actual_fader() == 0) {
d->Destroy ();
return;
}
diff --git a/src/wx/kdm_dialog.cc b/src/wx/kdm_dialog.cc
index 4334fd446..6a1f8051f 100644
--- a/src/wx/kdm_dialog.cc
+++ b/src/wx/kdm_dialog.cc
@@ -309,11 +309,11 @@ void
KDMDialog::add_cinema_clicked ()
{
CinemaDialog* d = new CinemaDialog (this, "Add Cinema");
- d->ShowModal ();
-
- shared_ptr<Cinema> c (new Cinema (d->name(), d->email()));
- Config::instance()->add_cinema (c);
- add_cinema (c);
+ if (d->ShowModal () == wxID_OK) {
+ shared_ptr<Cinema> c (new Cinema (d->name(), d->email()));
+ Config::instance()->add_cinema (c);
+ add_cinema (c);
+ }
d->Destroy ();
}
@@ -328,13 +328,12 @@ KDMDialog::edit_cinema_clicked ()
pair<wxTreeItemId, shared_ptr<Cinema> > c = selected_cinemas().front();
CinemaDialog* d = new CinemaDialog (this, "Edit cinema", c.second->name, c.second->email);
- d->ShowModal ();
-
- c.second->name = d->name ();
- c.second->email = d->email ();
- _targets->SetItemText (c.first, std_to_wx (d->name()));
-
- Config::instance()->changed ();
+ if (d->ShowModal () == wxID_OK) {
+ c.second->name = d->name ();
+ c.second->email = d->email ();
+ _targets->SetItemText (c.first, std_to_wx (d->name()));
+ Config::instance()->changed ();
+ }
d->Destroy ();
}
@@ -385,13 +384,12 @@ KDMDialog::edit_screen_clicked ()
pair<wxTreeItemId, shared_ptr<Screen> > s = selected_screens().front();
ScreenDialog* d = new ScreenDialog (this, "Edit screen", s.second->name, s.second->certificate);
- d->ShowModal ();
-
- s.second->name = d->name ();
- s.second->certificate = d->certificate ();
- _targets->SetItemText (s.first, std_to_wx (d->name()));
-
- Config::instance()->changed ();
+ if (d->ShowModal () == wxID_OK) {
+ s.second->name = d->name ();
+ s.second->certificate = d->certificate ();
+ _targets->SetItemText (s.first, std_to_wx (d->name()));
+ Config::instance()->changed ();
+ }
d->Destroy ();
}
@@ -528,14 +526,17 @@ KDMDialog::update_cpl_summary ()
void
KDMDialog::cpl_browse_clicked ()
{
- wxFileDialog d (this, _("Select CPL XML file"), wxEmptyString, wxEmptyString, "*.xml");
- if (d.ShowModal() == wxID_CANCEL) {
+ wxFileDialog* d = new wxFileDialog (this, _("Select CPL XML file"), wxEmptyString, wxEmptyString, "*.xml");
+ if (d->ShowModal() == wxID_CANCEL) {
+ d->Destroy ();
return;
}
- boost::filesystem::path cpl_file (wx_to_std (d.GetPath ()));
+ boost::filesystem::path cpl_file (wx_to_std (d->GetPath ()));
boost::filesystem::path dcp_dir = cpl_file.parent_path ();
+ d->Destroy ();
+
/* XXX: hack alert */
cxml::Document cpl_document ("CompositionPlaylist");
cpl_document.read_file (cpl_file);