diff --git a/src/app/ui/editor/play_state.cpp b/src/app/ui/editor/play_state.cpp index 1a93d1f19..33df9ab6b 100644 --- a/src/app/ui/editor/play_state.cpp +++ b/src/app/ui/editor/play_state.cpp @@ -21,6 +21,8 @@ #include "ui/message.h" #include "ui/system.h" +#include "ui/manager.h" + namespace app { using namespace ui; @@ -148,6 +150,11 @@ void PlayState::onPlaybackTick() // Before executing any command, we stop the animation void PlayState::onBeforeCommandExecution(Command* command) { + // This check just in case we stay connected to context signals when + // the editor is already deleted. + ASSERT(m_editor); + ASSERT(m_editor->getManager() == ui::Manager::getDefault()); + // If the command is for other editor, we don't stop the animation. if (!m_editor->isActive()) return; diff --git a/src/app/ui/editor/play_state.h b/src/app/ui/editor/play_state.h index 5ade3df21..7186e494e 100644 --- a/src/app/ui/editor/play_state.h +++ b/src/app/ui/editor/play_state.h @@ -10,6 +10,7 @@ #pragma once #include "app/ui/editor/state_with_wheel_behavior.h" +#include "base/connection.h" #include "doc/frame.h" #include "ui/timer.h" @@ -49,7 +50,7 @@ namespace app { bool m_pingPongForward; doc::frame_t m_refFrame; - Connection m_ctxConn; + ScopedConnection m_ctxConn; }; } // namespace app