mirror of
https://github.com/overte-org/overte.git
synced 2025-04-15 11:08:06 +02:00
Fix TextureBaker failures and heap corruption in MaterialBaker
This commit is contained in:
parent
5856ab3d3a
commit
39cf3c3d83
1 changed files with 6 additions and 1 deletions
|
@ -144,7 +144,12 @@ void MaterialBaker::processMaterial() {
|
|||
connect(textureBaker.data(), &TextureBaker::finished, this, &MaterialBaker::handleFinishedTextureBaker);
|
||||
_textureBakers.insert(textureKey, textureBaker);
|
||||
textureBaker->moveToThread(_getNextOvenWorkerThreadOperator ? _getNextOvenWorkerThreadOperator() : thread());
|
||||
QMetaObject::invokeMethod(textureBaker.data(), "bake");
|
||||
// By default, Qt will invoke this bake immediately if the TextureBaker is on the same worker thread as this MaterialBaker.
|
||||
// We don't want that, because threads may be waiting for work while this thread is stuck processing a TextureBaker.
|
||||
// On top of that, _textureBakers isn't fully populated.
|
||||
// So, use Qt::QueuedConnection.
|
||||
// TODO: Better thread utilization at the top level, not just the MaterialBaker level
|
||||
QMetaObject::invokeMethod(textureBaker.data(), "bake", Qt::QueuedConnection);
|
||||
}
|
||||
_materialsNeedingRewrite.insert(textureKey, networkMaterial.second);
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue