Cleanup: use ScopeGuard.
[dcpomatic.git] / 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()));