Fix a problem not showing the "modified" state in tabs correctly after the first DrawingState.

This commit is contained in:
David Capello 2012-06-15 21:55:32 -03:00
parent 3bbf7af991
commit 805a0333d7
2 changed files with 13 additions and 7 deletions

View File

@ -58,10 +58,7 @@ DrawingState::DrawingState(tools::ToolLoop* toolLoop, Editor* editor, Message* m
DrawingState::~DrawingState()
{
delete m_toolLoopManager;
delete m_toolLoop;
m_toolLoopManager = NULL;
m_toolLoop = NULL;
destroyLoop();
}
bool DrawingState::onMouseDown(Editor* editor, Message* msg)
@ -75,9 +72,7 @@ bool DrawingState::onMouseDown(Editor* editor, Message* msg)
// Cancel drawing loop
if (m_toolLoopManager->isCanceled()) {
m_toolLoopManager->releaseLoop(pointer_from_msg(msg));
delete m_toolLoopManager;
m_toolLoopManager = NULL;
destroyLoop();
// Change to standby state
editor->backToPreviousState();
@ -96,6 +91,7 @@ bool DrawingState::onMouseUp(Editor* editor, Message* msg)
return true;
m_toolLoopManager->releaseLoop(pointer_from_msg(msg));
destroyLoop();
// Back to standby state.
editor->backToPreviousState();
@ -162,3 +158,11 @@ bool DrawingState::onUpdateStatusBar(Editor* editor)
// method called by the ToolLoopManager.
return false;
}
void DrawingState::destroyLoop()
{
delete m_toolLoopManager;
delete m_toolLoop;
m_toolLoopManager = NULL;
m_toolLoop = NULL;
}

View File

@ -45,6 +45,8 @@ public:
virtual bool requirePenPreview() OVERRIDE { return false; }
private:
void destroyLoop();
// The tool-loop.
tools::ToolLoop* m_toolLoop;