PixelPaint: Don't select the same layer twice in LayerListWidget

Without this check we would do an unnecessary partial second round
trip because of the call chain:
LayerListWidget::set_selected_layer() ->
LayerListWidget::on_layer_select() ->
ImageEditor::set_active_layer() ->
ImageEditor::on_active_layer_change() ->
LayerListWidget::set_selected_layer()
This commit is contained in:
Marcus Nilsson 2021-08-15 18:22:12 +02:00 committed by Andreas Kling
parent eaa99968fb
commit b76fe6357a
Notes: sideshowbarker 2024-07-18 03:52:42 +09:00

View file

@ -342,6 +342,10 @@ void LayerListWidget::set_selected_layer(Layer* layer)
{
if (!m_image)
return;
if (layer->is_selected())
return;
for (size_t i = 0; i < m_image->layer_count(); ++i) {
if (layer == &m_image->layer(i)) {
m_image->layer(i).set_selected(true);