UI: Fix filter rename crash

This commit is contained in:
Clayton Groeneveld 2020-03-12 16:07:05 -05:00
parent 314a53872d
commit e6ec3c87de
2 changed files with 7 additions and 0 deletions

View File

@ -738,6 +738,9 @@ void OBSBasicFilters::CustomContextMenu(const QPoint &pos, bool async)
void OBSBasicFilters::EditItem(QListWidgetItem *item, bool async)
{
if (editActive)
return;
Qt::ItemFlags flags = item->flags();
OBSSource filter = item->data(Qt::UserRole).value<OBSSource>();
const char *name = obs_source_get_name(filter);
@ -748,6 +751,7 @@ void OBSBasicFilters::EditItem(QListWidgetItem *item, bool async)
list->removeItemWidget(item);
list->editItem(item);
item->setFlags(flags);
editActive = true;
}
void OBSBasicFilters::on_asyncFilters_customContextMenuRequested(
@ -814,6 +818,7 @@ void OBSBasicFilters::FilterNameEdited(QWidget *editor, QListWidget *list)
listItem->setText(QString());
SetupVisibilityItem(list, listItem, filter);
editActive = false;
}
void OBSBasicFilters::AsyncFilterNameEdited(

View File

@ -74,6 +74,8 @@ private:
int noPreviewMargin;
bool editActive = false;
private slots:
void AddFilter(OBSSource filter);
void RemoveFilter(OBSSource filter);