Fix NameUsed() of source and scene selection widgets

Would always return false as the variable would already be deleted
whenever NameUsed() was called
This commit is contained in:
WarmUpTill 2023-05-01 02:45:30 +02:00 committed by WarmUpTill
parent 8cd818b80e
commit dd572a7456
2 changed files with 4 additions and 14 deletions

View File

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

View File

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