mirror of
https://github.com/aseprite/aseprite.git
synced 2024-11-20 14:21:45 +00:00
Fix crash (using freed memory) changing Screen/UI Scaling/Theme for a very specific ColorBar/PaletteView case (fix #3906)
We were able to reproduce this putting the black border of the ColorBar's PaletteView touching its viewport, and changing from Screen Scaling=200% & UI Scaling=100% to Screen Scaling=100% & UI Scaling=200% (with the memory sanitizer on).
This commit is contained in:
parent
fa79619c16
commit
2f54bcaf37
@ -1696,7 +1696,12 @@ void Widget::onBroadcastMouseMessage(const gfx::Point& screenPos,
|
||||
|
||||
void Widget::onInitTheme(InitThemeEvent& ev)
|
||||
{
|
||||
for (auto child : children())
|
||||
// Create a copy of the children list and iterate it, just in case a
|
||||
// initTheme() modifies this list (e.g. this can happen in some
|
||||
// strange cases with viewports, where scrollbars are added/removed
|
||||
// while we init the theme if the UI scale changes).
|
||||
auto children = m_children;
|
||||
for (auto child : children)
|
||||
child->initTheme();
|
||||
|
||||
if (m_theme) {
|
||||
|
Loading…
Reference in New Issue
Block a user