1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:57:35 +00:00

PixelPaint: Correct active tool ImageEditor sync issue

This fixes a scenario in which the active tool can get out of sync in
regards to what it believes it the current ImageEditor. In the case
where multiple images are open, switching between the editor tabs with a
tool selected can lead to this unsynchronized state due to a check that
the ImageEditor's active tool matches the current tool. If this is the
case the method returns early before we properly set the new editor
pointer on the active tool.
This commit is contained in:
Timothy Slater 2022-11-03 12:27:50 -05:00 committed by Andrew Kaster
parent 8768417b1c
commit 461ee18d64

View file

@ -490,8 +490,11 @@ ErrorOr<void> ImageEditor::add_new_layer_from_selection()
void ImageEditor::set_active_tool(Tool* tool)
{
if (m_active_tool == tool)
if (m_active_tool == tool) {
if (m_active_tool)
m_active_tool->setup(*this);
return;
}
if (m_active_tool)
m_active_tool->clear();