mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-23 18:39:55 +00:00
Remove PlayState as Context observer when ~PlayState is called (fix #682)
To do this we just use a ScopedConnection (which automatically disconnect the connection in its destructor).
This commit is contained in:
parent
df29126353
commit
cd922fc4c2
@ -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;
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user