Fix font_id_map errors when importing DCP subtitles that have no
[dcpomatic.git] / src / tools / dcpomatic.cc
index 6f55b1771b88f2bbbc352520aa7c7deae10005b7..772d90050687f3daa5b0c9e97c6f2845afd5fcd8 100644 (file)
@@ -372,7 +372,7 @@ public:
                _film_editor->content_panel()->SelectionChanged.connect (boost::bind (&DOMFrame::set_menu_sensitivity, this));
                set_title ();
 
-               JobManager::instance()->ActiveJobsChanged.connect (boost::bind (&DOMFrame::set_menu_sensitivity, this));
+               JobManager::instance()->ActiveJobsChanged.connect(boost::bind(&DOMFrame::active_jobs_changed, this));
 
                overall_panel->SetSizer (main_sizer);
 
@@ -1200,6 +1200,15 @@ private:
                ev.Skip ();
        }
 
+       void active_jobs_changed()
+       {
+               /* ActiveJobsChanged can be called while JobManager holds a lock on its mutex, making
+                * the call to JobManager::get() in set_menu_sensitivity() deadlock unless we work around
+                * it by using an idle callback.  This feels quite unpleasant.
+                */
+               signal_manager->when_idle(boost::bind(&DOMFrame::set_menu_sensitivity, this));
+       }
+
        void set_menu_sensitivity ()
        {
                auto jobs = JobManager::instance()->get ();
@@ -1597,7 +1606,7 @@ private:
                try {
                        wxInitAllImageHandlers ();
 
-                       Config::FailedToLoad.connect (boost::bind (&App::config_failed_to_load, this));
+                       Config::FailedToLoad.connect(boost::bind(&App::config_failed_to_load, this, _1));
                        Config::Warning.connect (boost::bind (&App::config_warning, this, _1));
 
                        _splash = maybe_show_splash ();
@@ -1819,9 +1828,9 @@ private:
                }
        }
 
-       void config_failed_to_load ()
+       void config_failed_to_load (Config::LoadFailure what)
        {
-               message_dialog (_frame, _("The existing configuration failed to load.  Default values will be used instead.  These may take a short time to create."));
+               report_config_load_failure(_frame, what);
        }
 
        void config_warning (string m)