From 18e6da6d4d150a997290fc98ddc4a80cc2aaa9fc Mon Sep 17 00:00:00 2001 From: Marcus Nilsson Date: Sun, 9 Jan 2022 13:41:38 +0100 Subject: [PATCH] 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. --- Userland/Applications/PixelPaint/LayerPropertiesWidget.cpp | 2 +- Userland/Applications/PixelPaint/LayerPropertiesWidget.h | 2 +- 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 m_opacity_slider; RefPtr m_name_textbox; - WeakPtr m_layer; + RefPtr m_layer; }; }