From d3463e0772349ea6ad0e3833dc12d34fc2130618 Mon Sep 17 00:00:00 2001 From: Palana Date: Wed, 14 May 2014 22:20:08 +0200 Subject: [PATCH] Release sources after name check --- obs/window-basic-main.cpp | 5 ++++- obs/window-basic-source-select.cpp | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/obs/window-basic-main.cpp b/obs/window-basic-main.cpp index 68ff3a13f..754040d3a 100644 --- a/obs/window-basic-main.cpp +++ b/obs/window-basic-main.cpp @@ -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"), diff --git a/obs/window-basic-source-select.cpp b/obs/window-basic-source-select.cpp index 2ea8fa7e3..b4a6beae6 100644 --- a/obs/window-basic-source-select.cpp +++ b/obs/window-basic-source-select.cpp @@ -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.