UI: Fix crash when toggling volume control mode

The toggleControlLayoutAction (change between horizontal and vertical
display mode) deletes and re-recreates the volume controls, meaning we
were writing to freed memory. This is a kind of hacky fix but it's the
only action we need to be concerned with for now.
master
Richard Stanway 2022-08-21 21:18:22 +02:00 committed by Jim
parent 2c7ef7d682
commit c64997ed80
1 changed files with 5 additions and 2 deletions

View File

@ -3509,8 +3509,11 @@ void OBSBasic::VolControlContextMenu()
popup.addAction(&filtersAction);
popup.addAction(&propertiesAction);
popup.addAction(&advPropAction);
popup.exec(QCursor::pos());
vol->SetContextMenu(nullptr);
// toggleControlLayoutAction deletes and re-creates the volume controls
// meaning that "vol" would be pointing to freed memory.
if (popup.exec(QCursor::pos()) != &toggleControlLayoutAction)
vol->SetContextMenu(nullptr);
}
void OBSBasic::on_hMixerScrollArea_customContextMenuRequested()