From 461ee18d640d87733509e7b4b8ee3147327bbc40 Mon Sep 17 00:00:00 2001 From: Timothy Slater Date: Thu, 3 Nov 2022 12:27:50 -0500 Subject: 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. --- Userland/Applications/PixelPaint/ImageEditor.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Userland') diff --git a/Userland/Applications/PixelPaint/ImageEditor.cpp b/Userland/Applications/PixelPaint/ImageEditor.cpp index f4478e7dd2..6862492e66 100644 --- a/Userland/Applications/PixelPaint/ImageEditor.cpp +++ b/Userland/Applications/PixelPaint/ImageEditor.cpp @@ -490,8 +490,11 @@ ErrorOr 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(); -- cgit v1.2.3