Skip to content

Commit 919006e

Browse files
committed
Fix material removal clearing all instances of shared texture arrays
1 parent e67074d commit 919006e

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

drivers/gles3/storage/material_storage.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2398,7 +2398,8 @@ void MaterialStorage::material_free(RID p_rid) {
23982398
// This happens when the app is being closed.
23992399
for (KeyValue<StringName, Variant> &E : material->params) {
24002400
if (E.value.get_type() == Variant::ARRAY) {
2401-
Array(E.value).clear();
2401+
// Clear the array for this material only (the array may be shared).
2402+
E.value = Variant();
24022403
}
24032404
}
24042405

servers/rendering/renderer_rd/storage_rd/material_storage.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2235,7 +2235,8 @@ void MaterialStorage::material_free(RID p_rid) {
22352235
// This happens when the app is being closed.
22362236
for (KeyValue<StringName, Variant> &E : material->params) {
22372237
if (E.value.get_type() == Variant::ARRAY) {
2238-
Array(E.value).clear();
2238+
// Clear the array for this material only (the array may be shared).
2239+
E.value = Variant();
22392240
}
22402241
}
22412242

0 commit comments

Comments
 (0)