From 05e8bea73684acfadb1c1b41dd839e865c43df8d Mon Sep 17 00:00:00 2001 From: Marcus Nilsson Date: Thu, 1 Jul 2021 23:31:23 +0200 Subject: [PATCH] PixelPaint: Reset layer widgets when closing last tab When closing the last tab the layer list widget and layer properties widget did not reset since they still had a pointer to the image. --- Userland/Applications/PixelPaint/main.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Userland/Applications/PixelPaint/main.cpp b/Userland/Applications/PixelPaint/main.cpp index 9748e26038..bd2fc9d9a6 100644 --- a/Userland/Applications/PixelPaint/main.cpp +++ b/Userland/Applications/PixelPaint/main.cpp @@ -553,6 +553,12 @@ int main(int argc, char** argv) tab_widget.on_tab_close_click = [&](auto& widget) { auto& image_editor = verify_cast(widget); + + if (tab_widget.children().size() == 1) { + layer_list_widget.set_image(nullptr); + layer_properties_widget.set_layer(nullptr); + } + tab_widget.deferred_invoke([&](auto&) { tab_widget.remove_tab(image_editor); });