summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorTimothy Slater <tslater2006@gmail.com>2022-11-03 12:27:50 -0500
committerAndrew Kaster <andrewdkaster@gmail.com>2022-11-13 16:08:48 -0700
commit461ee18d640d87733509e7b4b8ee3147327bbc40 (patch)
treef2abf7380332eca7243784f214006ef75886cff7 /Userland
parent8768417b1c9a9995ac4a50415b439869f2dabe54 (diff)
downloadserenity-461ee18d640d87733509e7b4b8ee3147327bbc40.zip
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.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Applications/PixelPaint/ImageEditor.cpp5
1 files changed, 4 insertions, 1 deletions
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<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();