We must only link gtk2 if wx is also using it.
[dcpomatic.git] / src / wx / subtitle_appearance_dialog.cc
index 339388be6e14e0eb25141f2efc8a49ea358599f3..76e8d8b16d00f1df23698d07257278779f43f14d 100644 (file)
@@ -40,6 +40,7 @@ using boost::shared_ptr;
 using boost::bind;
 using boost::dynamic_pointer_cast;
 using boost::optional;
+using namespace dcpomatic;
 
 int const SubtitleAppearanceDialog::NONE = 0;
 int const SubtitleAppearanceDialog::OUTLINE = 1;
@@ -58,7 +59,7 @@ SubtitleAppearanceDialog::SubtitleAppearanceDialog (wxWindow* parent, shared_ptr
                /* XXX: assuming that all FFmpeg streams have bitmap subs */
                if (_stream->colours().empty()) {
                        _job_manager_connection = JobManager::instance()->ActiveJobsChanged.connect(boost::bind(&SubtitleAppearanceDialog::active_jobs_changed, this, _1));
-                       JobManager::instance()->add(shared_ptr<Job>(new ExamineFFmpegSubtitlesJob(film, ff)));
+                       _job = JobManager::instance()->add(shared_ptr<Job>(new ExamineFFmpegSubtitlesJob(film, ff)));
                }
        }
 
@@ -107,7 +108,10 @@ SubtitleAppearanceDialog::SubtitleAppearanceDialog (wxWindow* parent, shared_ptr
                t->SetLabelMarkup (_("<b>New colour</b>"));
                _colour_table->Add (t, 1, wxALIGN_CENTER);
 
-               add_colours ();
+               shared_ptr<Job> job = _job.lock ();
+               if (!job || job->finished()) {
+                       add_colours ();
+               }
 
                _colours_panel->SetSizer (_colour_table);