Fix problem showing exception in ~ToolLoopImpl()

We cannot have DrawingState::m_toolLoopManager = nullptr when we call
Console::showException() (as the Editor will continue sending some mouse
messages to the DrawingState).
This commit is contained in:
David Capello 2015-04-10 11:12:19 -03:00
parent 1bed018ab0
commit 61edf07fdc
3 changed files with 6 additions and 2 deletions

View File

@ -59,6 +59,7 @@ namespace app {
enum Button { Left = 0, Right = 1 };
virtual ~ToolLoop() { }
virtual void dispose() = 0;
// Returns the tool to use to draw or use
virtual Tool* getTool() = 0;

View File

@ -201,6 +201,9 @@ void DrawingState::onExposeSpritePixels(const gfx::Region& rgn)
void DrawingState::destroyLoop()
{
if (m_toolLoop)
m_toolLoop->dispose();
delete m_toolLoopManager;
delete m_toolLoop;
m_toolLoopManager = NULL;

View File

@ -184,7 +184,8 @@ public:
m_offset.y = -y1;
}
~ToolLoopImpl()
// IToolLoop interface
void dispose() override
{
bool redraw = false;
@ -230,7 +231,6 @@ public:
update_screen_for_document(m_document);
}
// IToolLoop interface
tools::Tool* getTool() override { return m_tool; }
Brush* getBrush() override { return m_brush; }
Document* getDocument() override { return m_document; }