diff --git a/drivers/gles3/storage/material_storage.cpp b/drivers/gles3/storage/material_storage.cpp index c29c741c2a1..ee19ba9ee17 100644 --- a/drivers/gles3/storage/material_storage.cpp +++ b/drivers/gles3/storage/material_storage.cpp @@ -1506,6 +1506,8 @@ MaterialStorage::~MaterialStorage() { memdelete_arr(global_shader_uniforms.buffer_dirty_regions); glDeleteBuffers(1, &global_shader_uniforms.buffer); + material_update_list.clear(); + singleton = nullptr; } diff --git a/servers/rendering/renderer_rd/storage_rd/material_storage.cpp b/servers/rendering/renderer_rd/storage_rd/material_storage.cpp index 3bfc1bd15ca..7211e2696d0 100644 --- a/servers/rendering/renderer_rd/storage_rd/material_storage.cpp +++ b/servers/rendering/renderer_rd/storage_rd/material_storage.cpp @@ -1180,6 +1180,8 @@ MaterialStorage::~MaterialStorage() { //def samplers samplers_rd_free(default_samplers); + material_update_list.clear(); + singleton = nullptr; }