From dd572a74568d1402ab289b75c912d4e2a98855f9 Mon Sep 17 00:00:00 2001 From: WarmUpTill Date: Mon, 1 May 2023 02:45:30 +0200 Subject: [PATCH] Fix NameUsed() of source and scene selection widgets Would always return false as the variable would already be deleted whenever NameUsed() was called --- src/utils/scene-selection.cpp | 9 ++------- src/utils/source-selection.cpp | 9 ++------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/src/utils/scene-selection.cpp b/src/utils/scene-selection.cpp index 14ff04d8..c0340461 100644 --- a/src/utils/scene-selection.cpp +++ b/src/utils/scene-selection.cpp @@ -432,13 +432,8 @@ bool SceneSelectionWidget::NameUsed(const QString &name) _currentSelection._group->name == name.toStdString()) { return true; } - if (_currentSelection._type == SceneSelection::Type::VARIABLE) { - auto var = _currentSelection._variable.lock(); - if (var && var->Name() == name.toStdString()) { - return true; - } - } - return false; + return _currentSelection._type == SceneSelection::Type::VARIABLE && + currentText() == name; } void SceneSelectionWidget::ItemRemove(const QString &name) diff --git a/src/utils/source-selection.cpp b/src/utils/source-selection.cpp index 80cf12e9..9d7aef25 100644 --- a/src/utils/source-selection.cpp +++ b/src/utils/source-selection.cpp @@ -240,13 +240,8 @@ void SourceSelectionWidget::ItemAdd(const QString &) bool SourceSelectionWidget::NameUsed(const QString &name) { - if (_currentSelection._type == SourceSelection::Type::VARIABLE) { - auto var = _currentSelection._variable.lock(); - if (var && var->Name() == name.toStdString()) { - return true; - } - } - return false; + return _currentSelection._type == SourceSelection::Type::VARIABLE && + currentText() == name; } void SourceSelectionWidget::ItemRemove(const QString &name)