mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-03-22 09:54:54 -05:00
Fix crash when deleting last macro
A crash could occur if the last macro was deleted and the highlighting of macro segments was enabled due to the macro segments already being deleted while the widgets representing these segments were not
This commit is contained in:
parent
a9c79b02ff
commit
e89343b03e
|
|
@ -220,11 +220,11 @@ void AdvSceneSwitcher::RemoveMacroAction(int idx)
|
|||
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
actionsList->Remove(idx);
|
||||
macro->Actions().erase(macro->Actions().begin() + idx);
|
||||
switcher->abortMacroWait = true;
|
||||
switcher->macroWaitCv.notify_all();
|
||||
macro->UpdateActionIndices();
|
||||
actionsList->Remove(idx);
|
||||
SetActionData(*macro);
|
||||
}
|
||||
MacroActionSelectionChanged(-1);
|
||||
|
|
|
|||
|
|
@ -437,13 +437,13 @@ void AdvSceneSwitcher::RemoveMacroCondition(int idx)
|
|||
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
conditionsList->Remove(idx);
|
||||
macro->Conditions().erase(macro->Conditions().begin() + idx);
|
||||
macro->UpdateConditionIndices();
|
||||
if (idx == 0 && macro->Conditions().size() > 0) {
|
||||
auto newRoot = macro->Conditions().at(0);
|
||||
newRoot->SetLogicType(LogicType::ROOT_NONE);
|
||||
}
|
||||
conditionsList->Remove(idx);
|
||||
SetConditionData(*macro);
|
||||
}
|
||||
MacroConditionSelectionChanged(-1);
|
||||
|
|
|
|||
|
|
@ -98,12 +98,13 @@ void AdvSceneSwitcher::on_macroRemove_clicked()
|
|||
if (!item) {
|
||||
return;
|
||||
}
|
||||
int idx = ui->macros->currentRow();
|
||||
delete item;
|
||||
QString name;
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
switcher->abortMacroWait = true;
|
||||
switcher->macroWaitCv.notify_all();
|
||||
int idx = ui->macros->currentRow();
|
||||
QString::fromStdString(switcher->macros[idx]->Name());
|
||||
switcher->macros.erase(switcher->macros.begin() + idx);
|
||||
for (auto &m : switcher->macros) {
|
||||
|
|
@ -111,8 +112,6 @@ void AdvSceneSwitcher::on_macroRemove_clicked()
|
|||
}
|
||||
}
|
||||
|
||||
delete item;
|
||||
|
||||
if (ui->macros->count() == 0) {
|
||||
ui->macroHelp->setVisible(true);
|
||||
}
|
||||
|
|
@ -360,6 +359,10 @@ void AdvSceneSwitcher::on_macros_currentRowChanged(int idx)
|
|||
|
||||
if (idx == -1) {
|
||||
SetMacroEditAreaDisabled(true);
|
||||
conditionsList->Clear();
|
||||
actionsList->Clear();
|
||||
conditionsList->SetHelpMsgVisible(true);
|
||||
actionsList->SetHelpMsgVisible(true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user