Fix the player again (crash with subs in OpenGL mode) v2.18.9
authorCarl Hetherington <cth@carlh.net>
Sun, 26 Jan 2025 00:13:49 +0000 (01:13 +0100)
committerCarl Hetherington <cth@carlh.net>
Sun, 26 Jan 2025 00:13:49 +0000 (01:13 +0100)
Once again the player subtitle alignment wasn't being set up, because
this happens on _viewer.set_film().  _viewer.set_film() must therefore
happen after film_changed(), but then some things in film_changed()
need to happen after _viewer.set_film() (notably the info update and
menu sensitivity update).

src/tools/dcpomatic_player.cc

index 6accce7d23a2ee961852d842e6753ef3ba85f33f..e2c6892095fa575962dc16c4f16a4b8d6302ef34 100644 (file)
@@ -464,9 +464,14 @@ public:
        void reset_film(shared_ptr<Film> film = std::make_shared<Film>(boost::none))
        {
                _film = film;
+               film_changed();
+
                _viewer.set_film(_film);
+               _viewer.seek(DCPTime(), true);
+               _info->triggered_update();
+               set_menu_sensitivity();
+
                _controls->set_film (_film);
-               film_changed();
        }
 
        /* Update anything that depends on properties of the film or its contents */
@@ -517,11 +522,6 @@ public:
                        }
                }
 
-               _viewer.seek(DCPTime(), true);
-               _info->triggered_update ();
-
-               set_menu_sensitivity ();
-
                auto old = _cpl_menu->GetMenuItems();
                for (auto const& i: old) {
                        _cpl_menu->Remove (i);
@@ -731,7 +731,16 @@ private:
 
                        dcp->add_ov (wx_to_std(c->GetPath()));
                        auto job = make_shared<ExamineContentJob>(_film, dcp, true);
-                       _examine_job_connection = job->Finished.connect(boost::bind(&DOMFrame::film_changed, this));
+
+                       auto film_ready = [this]() {
+                               film_changed();
+                               _viewer.set_film(_film);
+                               _viewer.seek(DCPTime(), true);
+                               _info->triggered_update();
+                               set_menu_sensitivity();
+                       };
+
+                       _examine_job_connection = job->Finished.connect(boost::bind<void>(film_ready));
                        JobManager::instance()->add(job);
 
                        display_progress(variant::wx::dcpomatic_player(), _("Loading content"));