mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-16 10:20:50 +00:00
Fix access to memory out of scope on Sprite Properties when assigning/converting color profiles
Some buttons where calling the updateButtons() lambda that were defined inside a sub-scope of SpritePropertiesCommand::onExecute() (which is where the window is displayed ui::Window::openWindowInForeground()), the lambda was already out-of-scope when it was used by other lambdas.
This commit is contained in:
parent
98a660a06b
commit
42d5f10437
@ -71,6 +71,14 @@ void SpritePropertiesCommand::onExecute(Context* context)
|
||||
app::gen::SpriteProperties window;
|
||||
int selectedColorProfile = -1;
|
||||
|
||||
auto updateButtons =
|
||||
[&] {
|
||||
bool enabled = (selectedColorProfile != window.colorProfile()->getSelectedItemIndex());
|
||||
window.assignColorProfile()->setEnabled(enabled);
|
||||
window.convertColorProfile()->setEnabled(enabled);
|
||||
window.ok()->setEnabled(!enabled);
|
||||
};
|
||||
|
||||
// Get sprite properties and fill frame fields
|
||||
{
|
||||
const ContextReader reader(context);
|
||||
@ -153,14 +161,6 @@ void SpritePropertiesCommand::onExecute(Context* context)
|
||||
window.colorProfile()->addItem(cs->gfxColorSpace()->name());
|
||||
window.colorProfile()->setSelectedItemIndex(selectedColorProfile);
|
||||
|
||||
auto updateButtons =
|
||||
[&] {
|
||||
bool enabled = (selectedColorProfile != window.colorProfile()->getSelectedItemIndex());
|
||||
window.assignColorProfile()->setEnabled(enabled);
|
||||
window.convertColorProfile()->setEnabled(enabled);
|
||||
window.ok()->setEnabled(!enabled);
|
||||
};
|
||||
|
||||
window.assignColorProfile()->setEnabled(false);
|
||||
window.convertColorProfile()->setEnabled(false);
|
||||
window.colorProfile()->Change.connect(updateButtons);
|
||||
|
Loading…
x
Reference in New Issue
Block a user