summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Nilsson <brainbomb@gmail.com>2021-07-01 23:31:23 +0200
committerAndreas Kling <kling@serenityos.org>2021-07-02 17:54:01 +0200
commit05e8bea73684acfadb1c1b41dd839e865c43df8d (patch)
treed01d966131d6b1cf9ac425f5c97aa3336eea541f
parent54d4df668aaafee54295c44a560d726baceecd89 (diff)
downloadserenity-05e8bea73684acfadb1c1b41dd839e865c43df8d.zip
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.
-rw-r--r--Userland/Applications/PixelPaint/main.cpp6
1 files changed, 6 insertions, 0 deletions
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<PixelPaint::ImageEditor>(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);
});