Release sources after name check
This commit is contained in:
parent
4b2170a725
commit
d3463e0772
@ -967,8 +967,11 @@ void OBSBasic::on_actionAddScene_triggered()
|
||||
|
||||
int i = 1;
|
||||
QString placeHolderText = format.arg(i);
|
||||
while (obs_get_source_by_name(QT_TO_UTF8(placeHolderText)))
|
||||
obs_source_t source = nullptr;
|
||||
while ((source = obs_get_source_by_name(QT_TO_UTF8(placeHolderText)))) {
|
||||
obs_source_release(source);
|
||||
placeHolderText = format.arg(++i);
|
||||
}
|
||||
|
||||
bool accepted = NameDialog::AskForName(this,
|
||||
QTStr("Basic.Main.AddSceneDlg.Title"),
|
||||
|
@ -174,8 +174,11 @@ OBSBasicSourceSelect::OBSBasicSourceSelect(OBSBasic *parent, const char *type_)
|
||||
|
||||
QString text{placeHolderText};
|
||||
int i = 1;
|
||||
while (obs_get_source_by_name(QT_TO_UTF8(text)))
|
||||
obs_source_t source = nullptr;
|
||||
while ((source = obs_get_source_by_name(QT_TO_UTF8(text)))) {
|
||||
obs_source_release(source);
|
||||
text = QString("%1 %2").arg(placeHolderText).arg(i++);
|
||||
}
|
||||
|
||||
ui->sourceName->setText(text);
|
||||
ui->sourceName->setFocus(); //Fixes deselect of text.
|
||||
|
Loading…
x
Reference in New Issue
Block a user