diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2023-01-14 00:44:18 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-01-14 00:44:18 +0100 |
commit | a51ca2beafc5d74d3e62cb56fbba76ceb39160a3 (patch) | |
tree | 2926d6cf68850cc1e4357dbfaee13a5a3ddc9ddc /servers/rendering | |
parent | 02f5f56a42d59106c876f9e987ddb10b9e856571 (diff) | |
parent | 01cddbb12a33c21f308568e0b93ff1bb49dc2e7f (diff) |
Merge pull request #71346 from Chaosus/material_fix_freezing
Clear material arrays to prevent freeing of invalid texture RID
Diffstat (limited to 'servers/rendering')
-rw-r--r-- | servers/rendering/renderer_rd/storage_rd/material_storage.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/servers/rendering/renderer_rd/storage_rd/material_storage.cpp b/servers/rendering/renderer_rd/storage_rd/material_storage.cpp index 66ae1e8d1a..d631a89dd2 100644 --- a/servers/rendering/renderer_rd/storage_rd/material_storage.cpp +++ b/servers/rendering/renderer_rd/storage_rd/material_storage.cpp @@ -2685,6 +2685,14 @@ void MaterialStorage::material_free(RID p_rid) { Material *material = material_owner.get_or_null(p_rid); ERR_FAIL_COND(!material); + // Need to clear texture arrays to prevent spin locking of their RID's. + // This happens when the app is being closed. + for (KeyValue<StringName, Variant> &E : material->params) { + if (E.value.get_type() == Variant::ARRAY) { + Array(E.value).clear(); + } + } + material_set_shader(p_rid, RID()); //clean up shader material->dependency.deleted_notify(p_rid); |