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.
This commit is contained in:
Marcus Nilsson 2022-01-09 13:41:38 +01:00 committed by Linus Groh
parent 7ca4d045bd
commit 18e6da6d4d
Notes: sideshowbarker 2024-07-17 21:18:20 +09:00
2 changed files with 2 additions and 2 deletions

View File

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

View File

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