mirror of https://github.com/aseprite/aseprite.git
Fix a crash when a script generates a Fg/BgColor change when closing the app
If a script Dialog changes the app.fgColor/bgColor in its onclose callback, it will notify all fgColor/bgColor preference observers (ContextBar is one of them), if we don't disconnect from these signals when we're deleting ContextBar, the signals will call a deleted slot/connection from app::script::close_all_dialogs().
This commit is contained in:
parent
def9752199
commit
1630416991
|
@ -854,7 +854,7 @@ public:
|
|||
: ButtonSet(1) {
|
||||
addItem(SkinTheme::get(this)->parts.pivotCenter());
|
||||
|
||||
Preferences::instance().selection.pivotPosition.AfterChange.connect(
|
||||
m_pivotConn = Preferences::instance().selection.pivotPosition.AfterChange.connect(
|
||||
[this]{ onPivotChange(); });
|
||||
|
||||
onPivotChange();
|
||||
|
@ -925,6 +925,7 @@ private:
|
|||
getItem(0)->setIcon(part);
|
||||
}
|
||||
|
||||
obs::scoped_connection m_pivotConn;
|
||||
};
|
||||
|
||||
class ContextBar::RotAlgorithmField : public ComboBox {
|
||||
|
@ -1586,17 +1587,16 @@ ContextBar::ContextBar(TooltipManager* tooltipManager,
|
|||
UIContext::instance()->add_observer(this);
|
||||
|
||||
auto& pref = Preferences::instance();
|
||||
pref.symmetryMode.enabled.AfterChange.connect(
|
||||
|
||||
m_symmModeConn = pref.symmetryMode.enabled.AfterChange.connect(
|
||||
[this]{ onSymmetryModeChange(); });
|
||||
pref.colorBar.fgColor.AfterChange.connect(
|
||||
m_fgColorConn = pref.colorBar.fgColor.AfterChange.connect(
|
||||
[this]{ onFgOrBgColorChange(doc::Brush::ImageColor::MainColor); });
|
||||
pref.colorBar.bgColor.AfterChange.connect(
|
||||
m_bgColorConn = pref.colorBar.bgColor.AfterChange.connect(
|
||||
[this]{ onFgOrBgColorChange(doc::Brush::ImageColor::BackgroundColor); });
|
||||
|
||||
KeyboardShortcuts::instance()->UserChange.connect(
|
||||
m_keysConn = KeyboardShortcuts::instance()->UserChange.connect(
|
||||
[this, tooltipManager]{ setupTooltips(tooltipManager); });
|
||||
|
||||
m_dropPixels->DropPixels.connect(&ContextBar::onDropPixels, this);
|
||||
m_dropPixelsConn = m_dropPixels->DropPixels.connect(&ContextBar::onDropPixels, this);
|
||||
|
||||
setActiveBrush(createBrushFromPreferences());
|
||||
|
||||
|
|
|
@ -196,6 +196,11 @@ namespace app {
|
|||
ui::Label* m_selectBoxHelp;
|
||||
SymmetryField* m_symmetry;
|
||||
SliceFields* m_sliceFields;
|
||||
obs::scoped_connection m_symmModeConn;
|
||||
obs::scoped_connection m_fgColorConn;
|
||||
obs::scoped_connection m_bgColorConn;
|
||||
obs::scoped_connection m_keysConn;
|
||||
obs::scoped_connection m_dropPixelsConn;
|
||||
obs::scoped_connection m_sizeConn;
|
||||
obs::scoped_connection m_angleConn;
|
||||
obs::scoped_connection m_opacityConn;
|
||||
|
|
Loading…
Reference in New Issue