mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-29 19:20:09 +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
@ -114,6 +114,12 @@ class Editor : public Widget
|
||||
// user is not moving pixels.
|
||||
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:
|
||||
// in editor.c
|
||||
|
||||
|
@ -106,7 +106,8 @@ Editor::Editor()
|
||||
|
||||
jwidget_focusrest(this, true);
|
||||
|
||||
App::instance()->CurrentToolChange.connect(&Editor::onCurrentToolChange, this);
|
||||
m_currentToolChangeSlot =
|
||||
App::instance()->CurrentToolChange.connect(&Editor::onCurrentToolChange, this);
|
||||
}
|
||||
|
||||
Editor::~Editor()
|
||||
@ -119,6 +120,10 @@ Editor::~Editor()
|
||||
|
||||
// Destroy all decorators
|
||||
deleteDecorators();
|
||||
|
||||
// Remove this editor as listener of CurrentToolChange signal.
|
||||
App::instance()->CurrentToolChange.disconnect(m_currentToolChangeSlot);
|
||||
delete m_currentToolChangeSlot;
|
||||
}
|
||||
|
||||
int editor_type()
|
||||
|
Loading…
x
Reference in New Issue
Block a user