summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorMarcus Nilsson <brainbomb@gmail.com>2022-01-09 13:41:38 +0100
committerLinus Groh <mail@linusgroh.de>2022-01-09 20:24:02 +0100
commit18e6da6d4d150a997290fc98ddc4a80cc2aaa9fc (patch)
tree8f1d36cc1c20a6e7a1ac900d79428e6cfef95fca /Userland
parent7ca4d045bd67a6830c23e4091a7fa8fcf3d9f4b0 (diff)
downloadserenity-18e6da6d4d150a997290fc98ddc4a80cc2aaa9fc.zip
PixelPaint: Keep a RefPtr to layer in LayerPropertiesWidget
Using a WeakPtr to keep a reference to the active layer caused it to be destroyed when the last tab was closed, which made the m_layer == layer check in set_layer() return early since it was already null. Because of this the LayerPropertiesWidget was never disabled.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Applications/PixelPaint/LayerPropertiesWidget.cpp2
-rw-r--r--Userland/Applications/PixelPaint/LayerPropertiesWidget.h2
2 files changed, 2 insertions, 2 deletions
diff --git a/Userland/Applications/PixelPaint/LayerPropertiesWidget.cpp b/Userland/Applications/PixelPaint/LayerPropertiesWidget.cpp
index 2983860eea..f10cbfcdaf 100644
--- a/Userland/Applications/PixelPaint/LayerPropertiesWidget.cpp
+++ b/Userland/Applications/PixelPaint/LayerPropertiesWidget.cpp
@@ -75,7 +75,7 @@ void LayerPropertiesWidget::set_layer(Layer* layer)
return;
if (layer) {
- m_layer = layer->make_weak_ptr();
+ m_layer = layer;
m_name_textbox->set_text(layer->name());
m_opacity_slider->set_value(layer->opacity_percent());
m_visibility_checkbox->set_checked(layer->is_visible());
diff --git a/Userland/Applications/PixelPaint/LayerPropertiesWidget.h b/Userland/Applications/PixelPaint/LayerPropertiesWidget.h
index 37b362311a..33d212d335 100644
--- a/Userland/Applications/PixelPaint/LayerPropertiesWidget.h
+++ b/Userland/Applications/PixelPaint/LayerPropertiesWidget.h
@@ -27,7 +27,7 @@ private:
RefPtr<GUI::OpacitySlider> m_opacity_slider;
RefPtr<GUI::TextBox> m_name_textbox;
- WeakPtr<Layer> m_layer;
+ RefPtr<Layer> m_layer;
};
}