mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-09-19 20:32:15 +02:00
UI: Use deleteLater() rather than explicit delete
When an audio source is removed, it signals its "destroy" callbacks. One of the callbacks is OBSSourceLabel::SourceDestroyed. When its Qt destroy signal is fired, it causes a call to LoadAudioSources to refresh the source list. LoadAudioSources deletes the old layout, and so the QWidget that the OBSSource is based on is freed while it's still in the middle of running the signal callback, resulting in access to freed memory.
This commit is contained in:
parent
45d0b8ccee
commit
3667e556db
@ -2142,7 +2142,7 @@ void OBSBasicSettings::LoadAudioSources()
|
||||
{
|
||||
if (ui->audioSourceLayout->rowCount() > 0) {
|
||||
QLayoutItem *forDeletion = ui->audioSourceLayout->takeAt(0);
|
||||
delete forDeletion->widget();
|
||||
forDeletion->widget()->deleteLater();
|
||||
delete forDeletion;
|
||||
}
|
||||
auto layout = new QFormLayout();
|
||||
|
Loading…
Reference in New Issue
Block a user