MockCompositor: Protect against race condition
The QList m_fractionalScales was being changed from both the main thread and the dispatch thread. This lead to read-after-free AddressSanitizer errors when running autotests. Using a DirectConnection makes sure that both appending and removal happens in the same thread. This does not fix a theoretical race condition in DefaultCompositor::fractionalScale(). Fixes: QTBUG-130627 Pick-to: 6.8 Change-Id: Ie73f80d08929bcfcbd9940acdb4f86233df013cb Reviewed-by: David Edmundson <davidedmundson@kde.org>
This commit is contained in:
parent
77aeb195a4
commit
4781e2a088
@ -16,7 +16,7 @@ void FractionalScaleManager::wp_fractional_scale_manager_v1_get_fractional_scale
|
|||||||
auto *scaler = new FractionalScale(s, resource->client(), id, resource->version());
|
auto *scaler = new FractionalScale(s, resource->client(), id, resource->version());
|
||||||
connect(scaler, &QObject::destroyed, this, [this, scaler]() {
|
connect(scaler, &QObject::destroyed, this, [this, scaler]() {
|
||||||
m_fractionalScales.removeOne(scaler);
|
m_fractionalScales.removeOne(scaler);
|
||||||
});
|
}, Qt::DirectConnection);
|
||||||
m_fractionalScales << scaler;
|
m_fractionalScales << scaler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user