mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-02 22:21:21 +00:00
Fix a issue with Editor's slots: when an Editor is destroyed, we have to remove all slots from signals.
This commit is contained in:
parent
7f425c8acb
commit
fa4d98d599
src/widgets
@ -114,6 +114,12 @@ class Editor : public Widget
|
|||||||
// user is not moving pixels.
|
// user is not moving pixels.
|
||||||
PixelsMovement* m_pixelsMovement;
|
PixelsMovement* m_pixelsMovement;
|
||||||
|
|
||||||
|
// This slot is used to disconnect the Editor from CurrentToolChange
|
||||||
|
// signal (because the editor can be destroyed and the application
|
||||||
|
// still continue running and generating CurrentToolChange
|
||||||
|
// signals).
|
||||||
|
Slot0<void>* m_currentToolChangeSlot;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// in editor.c
|
// in editor.c
|
||||||
|
|
||||||
|
@ -106,7 +106,8 @@ Editor::Editor()
|
|||||||
|
|
||||||
jwidget_focusrest(this, true);
|
jwidget_focusrest(this, true);
|
||||||
|
|
||||||
App::instance()->CurrentToolChange.connect(&Editor::onCurrentToolChange, this);
|
m_currentToolChangeSlot =
|
||||||
|
App::instance()->CurrentToolChange.connect(&Editor::onCurrentToolChange, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
Editor::~Editor()
|
Editor::~Editor()
|
||||||
@ -119,6 +120,10 @@ Editor::~Editor()
|
|||||||
|
|
||||||
// Destroy all decorators
|
// Destroy all decorators
|
||||||
deleteDecorators();
|
deleteDecorators();
|
||||||
|
|
||||||
|
// Remove this editor as listener of CurrentToolChange signal.
|
||||||
|
App::instance()->CurrentToolChange.disconnect(m_currentToolChangeSlot);
|
||||||
|
delete m_currentToolChangeSlot;
|
||||||
}
|
}
|
||||||
|
|
||||||
int editor_type()
|
int editor_type()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user