Cleanup: use ScopeGuard.
authorCarl Hetherington <cth@carlh.net>
Sun, 19 Nov 2023 23:14:32 +0000 (00:14 +0100)
committerCarl Hetherington <cth@carlh.net>
Mon, 20 Nov 2023 20:18:40 +0000 (21:18 +0100)
src/tools/dcpomatic_player.cc

index 5dd0a0afe9f7b967bed8907a1d5cc280d6b38f72..6c6e756ec4fd76e978da9f7975f73e6a5e5690ca 100644 (file)
@@ -706,10 +706,12 @@ private:
                        DCPOMATIC_ASSERT (dcp);
                        try {
                                if (dcp) {
+                                       ScopeGuard sg([this]() {
+                                               _viewer.set_coalesce_player_changes(false);
+                                       });
                                        _viewer.set_coalesce_player_changes(true);
                                        dcp->add_kdm (dcp::EncryptedKDM(dcp::file_to_string(wx_to_std(d->GetPath()), MAX_KDM_SIZE)));
                                        examine_content();
-                                       _viewer.set_coalesce_player_changes(false);
                                }
                        } catch (exception& e) {
                                error_dialog (this, wxString::Format (_("Could not load KDM.")), std_to_wx(e.what()));