From d462d6280a7afcb73d82fb309719f53e31a0b6ee Mon Sep 17 00:00:00 2001 From: Torstennator Date: Mon, 11 Dec 2023 19:55:48 +0100 Subject: [PATCH] PixelPaint: Fix initial tool selection This changes how the initial tool is beeing set on application startup. With this change the initial tool is set the same way as when the tool is changed via the frontend. Thus it also updates the tool properties window which wasn't done before leaving the properties empty as long the tool was changed for the first time. --- Userland/Applications/PixelPaint/ToolboxWidget.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Userland/Applications/PixelPaint/ToolboxWidget.cpp b/Userland/Applications/PixelPaint/ToolboxWidget.cpp index 334e71cf97..a416128250 100644 --- a/Userland/Applications/PixelPaint/ToolboxWidget.cpp +++ b/Userland/Applications/PixelPaint/ToolboxWidget.cpp @@ -70,9 +70,12 @@ void ToolboxWidget::setup_tools() tool->set_action(action); m_tools.append(move(tool)); if (is_default_tool) { - VERIFY(m_active_tool == nullptr); - m_active_tool = m_tools[m_tools.size() - 1]; action->set_checked(true); + auto default_tool_index = m_tools.size() - 1; + deferred_invoke([&, default_tool_index]() { + VERIFY(m_active_tool == nullptr); + on_tool_selection(m_tools[default_tool_index]); + }); } };