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.
This commit is contained in:
Marcus Nilsson 2021-07-01 23:31:23 +02:00 committed by Andreas Kling
parent 54d4df668a
commit 05e8bea736
Notes: sideshowbarker 2024-07-18 11:06:52 +09:00

View File

@ -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);
});