summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-06-16 00:51:15 +0100
committerCarl Hetherington <cth@carlh.net>2016-06-16 00:51:15 +0100
commit1dd9fb73e28f079fb0d4ee46ab3e18008e42aca2 (patch)
treed664e31fc4331e0c0311e7657ff1a4323eb03a88 /src
parent5b7c8b06f7d9ea910020b4620c234cf0dce95a66 (diff)
Potential fix for crash on loading a new film after starting an audio analysis.
Diffstat (limited to 'src')
-rw-r--r--src/wx/audio_dialog.cc5
-rw-r--r--src/wx/audio_panel.cc10
-rw-r--r--src/wx/audio_panel.h1
-rw-r--r--src/wx/content_panel.cc2
-rw-r--r--src/wx/content_panel.h3
-rw-r--r--src/wx/dcp_panel.cc6
6 files changed, 25 insertions, 2 deletions
diff --git a/src/wx/audio_dialog.cc b/src/wx/audio_dialog.cc
index b2fb0efe5..c753de535 100644
--- a/src/wx/audio_dialog.cc
+++ b/src/wx/audio_dialog.cc
@@ -218,7 +218,10 @@ void
AudioDialog::analysis_finished ()
{
shared_ptr<const Film> film = _film.lock ();
- DCPOMATIC_ASSERT (film);
+ if (!film) {
+ /* This should not happen, but if it does we should just give up quietly */
+ return;
+ }
if (!boost::filesystem::exists (film->audio_analysis_path (_playlist))) {
/* We analysed and still nothing showed up, so maybe it was cancelled or it failed.
diff --git a/src/wx/audio_panel.cc b/src/wx/audio_panel.cc
index a2ede0bd6..ab26329a4 100644
--- a/src/wx/audio_panel.cc
+++ b/src/wx/audio_panel.cc
@@ -362,3 +362,13 @@ AudioPanel::reference_clicked ()
d->set_reference_audio (_reference->GetValue ());
}
+
+void
+AudioPanel::set_film (shared_ptr<Film>)
+{
+ /* We are changing film, so destroy any audio dialog for the old one */
+ if (_audio_dialog) {
+ _audio_dialog->Destroy ();
+ _audio_dialog = 0;
+ }
+}
diff --git a/src/wx/audio_panel.h b/src/wx/audio_panel.h
index aabfd71c1..fe9f1cdec 100644
--- a/src/wx/audio_panel.h
+++ b/src/wx/audio_panel.h
@@ -38,6 +38,7 @@ public:
void film_changed (Film::Property);
void film_content_changed (int);
void content_selection_changed ();
+ void set_film (boost::shared_ptr<Film>);
private:
void show_clicked ();
diff --git a/src/wx/content_panel.cc b/src/wx/content_panel.cc
index d1a00c021..b7878d3b3 100644
--- a/src/wx/content_panel.cc
+++ b/src/wx/content_panel.cc
@@ -403,6 +403,8 @@ ContentPanel::setup_sensitivity ()
void
ContentPanel::set_film (shared_ptr<Film> film)
{
+ _audio_panel->set_film (film);
+
_film = film;
film_changed (Film::CONTENT);
diff --git a/src/wx/content_panel.h b/src/wx/content_panel.h
index fe48e1e93..e1a66770c 100644
--- a/src/wx/content_panel.h
+++ b/src/wx/content_panel.h
@@ -32,6 +32,7 @@ class wxListEvent;
class TimelineDialog;
class FilmEditor;
class ContentSubPanel;
+class AudioPanel;
class Film;
class FilmViewer;
@@ -93,7 +94,7 @@ private:
wxButton* _later;
wxButton* _timeline;
ContentSubPanel* _video_panel;
- ContentSubPanel* _audio_panel;
+ AudioPanel* _audio_panel;
ContentSubPanel* _subtitle_panel;
ContentSubPanel* _timing_panel;
std::list<ContentSubPanel *> _panels;
diff --git a/src/wx/dcp_panel.cc b/src/wx/dcp_panel.cc
index 66a084259..461aeca71 100644
--- a/src/wx/dcp_panel.cc
+++ b/src/wx/dcp_panel.cc
@@ -496,6 +496,12 @@ DCPPanel::dcp_content_type_changed ()
void
DCPPanel::set_film (shared_ptr<Film> film)
{
+ /* We are changing film, so destroy any audio dialog for the old one */
+ if (_audio_dialog) {
+ _audio_dialog->Destroy ();
+ _audio_dialog = 0;
+ }
+
_film = film;
film_changed (Film::NAME);