0
0
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:
Richard Stanway 2020-02-24 15:29:12 -08:00 committed by jp9000
parent 45d0b8ccee
commit 3667e556db

View File

@ -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();