diff --git a/filament/src/details/Engine.cpp b/filament/src/details/Engine.cpp index a9c39de272d..576e0e081a8 100644 --- a/filament/src/details/Engine.cpp +++ b/filament/src/details/Engine.cpp @@ -1159,8 +1159,13 @@ bool FEngine::destroy(const FMaterial* ptr) { if (!ASSERT_PRECONDITION_NON_FATAL(pos->second.empty(), "destroying material \"%s\" but %u instances still alive", ptr->getName().c_str(), (*pos).second.size())) { - return false; + // We return true here, because the material has been destroyed. However, this + // leaks this material's ResourceList until the engine + // is shut down. Note that it's still possible for the MaterialInstances to be + // destroyed manually. + return true; } + mMaterialInstances.erase(pos); } } return success;