Add safety-checks before some servers free()

This commit is contained in:
Adam Scott 2022-12-12 12:42:37 -05:00
parent a754930918
commit ea33001b95
65 changed files with 125 additions and 1 deletions

View File

@ -436,6 +436,7 @@ EditorMaterialPreviewPlugin::EditorMaterialPreviewPlugin() {
} }
EditorMaterialPreviewPlugin::~EditorMaterialPreviewPlugin() { EditorMaterialPreviewPlugin::~EditorMaterialPreviewPlugin() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RS::get_singleton()->free(sphere); RS::get_singleton()->free(sphere);
RS::get_singleton()->free(sphere_instance); RS::get_singleton()->free(sphere_instance);
RS::get_singleton()->free(viewport); RS::get_singleton()->free(viewport);
@ -767,6 +768,7 @@ EditorMeshPreviewPlugin::EditorMeshPreviewPlugin() {
} }
EditorMeshPreviewPlugin::~EditorMeshPreviewPlugin() { EditorMeshPreviewPlugin::~EditorMeshPreviewPlugin() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
//RS::get_singleton()->free(sphere); //RS::get_singleton()->free(sphere);
RS::get_singleton()->free(mesh_instance); RS::get_singleton()->free(mesh_instance);
RS::get_singleton()->free(viewport); RS::get_singleton()->free(viewport);
@ -867,6 +869,7 @@ EditorFontPreviewPlugin::EditorFontPreviewPlugin() {
} }
EditorFontPreviewPlugin::~EditorFontPreviewPlugin() { EditorFontPreviewPlugin::~EditorFontPreviewPlugin() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RS::get_singleton()->free(canvas_item); RS::get_singleton()->free(canvas_item);
RS::get_singleton()->free(canvas); RS::get_singleton()->free(canvas);
RS::get_singleton()->free(viewport); RS::get_singleton()->free(viewport);

View File

@ -100,6 +100,7 @@ bool EditorNode3DGizmo::is_editable() const {
} }
void EditorNode3DGizmo::clear() { void EditorNode3DGizmo::clear() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
for (int i = 0; i < instances.size(); i++) { for (int i = 0; i < instances.size(); i++) {
if (instances[i].instance.is_valid()) { if (instances[i].instance.is_valid()) {
RS::get_singleton()->free(instances[i].instance); RS::get_singleton()->free(instances[i].instance);
@ -809,6 +810,7 @@ void EditorNode3DGizmo::transform() {
} }
void EditorNode3DGizmo::free() { void EditorNode3DGizmo::free() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
ERR_FAIL_COND(!spatial_node); ERR_FAIL_COND(!spatial_node);
ERR_FAIL_COND(!valid); ERR_FAIL_COND(!valid);

View File

@ -3557,6 +3557,7 @@ void Node3DEditorViewport::_init_gizmo_instance(int p_idx) {
} }
void Node3DEditorViewport::_finish_gizmo_instances() { void Node3DEditorViewport::_finish_gizmo_instances() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
RS::get_singleton()->free(move_gizmo_instance[i]); RS::get_singleton()->free(move_gizmo_instance[i]);
RS::get_singleton()->free(move_plane_gizmo_instance[i]); RS::get_singleton()->free(move_plane_gizmo_instance[i]);
@ -5536,6 +5537,7 @@ Node3DEditorViewportContainer::Node3DEditorViewportContainer() {
Node3DEditor *Node3DEditor::singleton = nullptr; Node3DEditor *Node3DEditor::singleton = nullptr;
Node3DEditorSelectedItem::~Node3DEditorSelectedItem() { Node3DEditorSelectedItem::~Node3DEditorSelectedItem() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
if (sbox_instance.is_valid()) { if (sbox_instance.is_valid()) {
RenderingServer::get_singleton()->free(sbox_instance); RenderingServer::get_singleton()->free(sbox_instance);
} }

View File

@ -1405,6 +1405,7 @@ GridMapEditor::GridMapEditor() {
} }
GridMapEditor::~GridMapEditor() { GridMapEditor::~GridMapEditor() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
_clear_clipboard_data(); _clear_clipboard_data();
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {

View File

@ -796,6 +796,10 @@ void GridMap::_octant_enter_world(const OctantKey &p_key) {
} }
void GridMap::_octant_exit_world(const OctantKey &p_key) { void GridMap::_octant_exit_world(const OctantKey &p_key) {
ERR_FAIL_NULL(RenderingServer::get_singleton());
ERR_FAIL_NULL(PhysicsServer3D::get_singleton());
ERR_FAIL_NULL(NavigationServer3D::get_singleton());
ERR_FAIL_COND(!octant_map.has(p_key)); ERR_FAIL_COND(!octant_map.has(p_key));
Octant &g = *octant_map[p_key]; Octant &g = *octant_map[p_key];
PhysicsServer3D::get_singleton()->body_set_state(g.static_body, PhysicsServer3D::BODY_STATE_TRANSFORM, get_global_transform()); PhysicsServer3D::get_singleton()->body_set_state(g.static_body, PhysicsServer3D::BODY_STATE_TRANSFORM, get_global_transform());
@ -834,6 +838,10 @@ void GridMap::_octant_exit_world(const OctantKey &p_key) {
} }
void GridMap::_octant_clean_up(const OctantKey &p_key) { void GridMap::_octant_clean_up(const OctantKey &p_key) {
ERR_FAIL_NULL(RenderingServer::get_singleton());
ERR_FAIL_NULL(PhysicsServer3D::get_singleton());
ERR_FAIL_NULL(NavigationServer3D::get_singleton());
ERR_FAIL_COND(!octant_map.has(p_key)); ERR_FAIL_COND(!octant_map.has(p_key));
Octant &g = *octant_map[p_key]; Octant &g = *octant_map[p_key];
@ -1186,6 +1194,7 @@ Vector3 GridMap::_get_offset() const {
} }
void GridMap::clear_baked_meshes() { void GridMap::clear_baked_meshes() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
for (int i = 0; i < baked_meshes.size(); i++) { for (int i = 0; i < baked_meshes.size(); i++) {
RS::get_singleton()->free(baked_meshes[i].instance); RS::get_singleton()->free(baked_meshes[i].instance);
} }

View File

@ -40,6 +40,7 @@ NoiseTexture2D::NoiseTexture2D() {
} }
NoiseTexture2D::~NoiseTexture2D() { NoiseTexture2D::~NoiseTexture2D() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
if (texture.is_valid()) { if (texture.is_valid()) {
RS::get_singleton()->free(texture); RS::get_singleton()->free(texture);
} }

View File

@ -661,5 +661,6 @@ CollisionObject2D::CollisionObject2D() {
} }
CollisionObject2D::~CollisionObject2D() { CollisionObject2D::~CollisionObject2D() {
ERR_FAIL_NULL(PhysicsServer2D::get_singleton());
PhysicsServer2D::get_singleton()->free(rid); PhysicsServer2D::get_singleton()->free(rid);
} }

View File

@ -1507,6 +1507,7 @@ CPUParticles2D::CPUParticles2D() {
} }
CPUParticles2D::~CPUParticles2D() { CPUParticles2D::~CPUParticles2D() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RS::get_singleton()->free(multimesh); RS::get_singleton()->free(multimesh);
RS::get_singleton()->free(mesh); RS::get_singleton()->free(mesh);
} }

View File

@ -688,6 +688,7 @@ GPUParticles2D::GPUParticles2D() {
} }
GPUParticles2D::~GPUParticles2D() { GPUParticles2D::~GPUParticles2D() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RS::get_singleton()->free(particles); RS::get_singleton()->free(particles);
RS::get_singleton()->free(mesh); RS::get_singleton()->free(mesh);
} }

View File

@ -246,6 +246,7 @@ Joint2D::Joint2D() {
} }
Joint2D::~Joint2D() { Joint2D::~Joint2D() {
ERR_FAIL_NULL(PhysicsServer2D::get_singleton());
PhysicsServer2D::get_singleton()->free(joint); PhysicsServer2D::get_singleton()->free(joint);
} }

View File

@ -321,6 +321,7 @@ Light2D::Light2D() {
} }
Light2D::~Light2D() { Light2D::~Light2D() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RenderingServer::get_singleton()->free(canvas_light); RenderingServer::get_singleton()->free(canvas_light);
} }

View File

@ -148,6 +148,7 @@ OccluderPolygon2D::OccluderPolygon2D() {
} }
OccluderPolygon2D::~OccluderPolygon2D() { OccluderPolygon2D::~OccluderPolygon2D() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RS::get_singleton()->free(occ_polygon); RS::get_singleton()->free(occ_polygon);
} }
@ -291,5 +292,7 @@ LightOccluder2D::LightOccluder2D() {
} }
LightOccluder2D::~LightOccluder2D() { LightOccluder2D::~LightOccluder2D() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RS::get_singleton()->free(occluder); RS::get_singleton()->free(occluder);
} }

View File

@ -197,6 +197,7 @@ NavigationAgent2D::NavigationAgent2D() {
} }
NavigationAgent2D::~NavigationAgent2D() { NavigationAgent2D::~NavigationAgent2D() {
ERR_FAIL_NULL(NavigationServer2D::get_singleton());
NavigationServer2D::get_singleton()->free(agent); NavigationServer2D::get_singleton()->free(agent);
agent = RID(); // Pointless agent = RID(); // Pointless
} }

View File

@ -285,6 +285,7 @@ NavigationLink2D::NavigationLink2D() {
} }
NavigationLink2D::~NavigationLink2D() { NavigationLink2D::~NavigationLink2D() {
ERR_FAIL_NULL(NavigationServer2D::get_singleton());
NavigationServer2D::get_singleton()->free(link); NavigationServer2D::get_singleton()->free(link);
link = RID(); link = RID();
} }

View File

@ -116,6 +116,7 @@ NavigationObstacle2D::NavigationObstacle2D() {
} }
NavigationObstacle2D::~NavigationObstacle2D() { NavigationObstacle2D::~NavigationObstacle2D() {
ERR_FAIL_NULL(NavigationServer2D::get_singleton());
NavigationServer2D::get_singleton()->free(agent); NavigationServer2D::get_singleton()->free(agent);
agent = RID(); // Pointless agent = RID(); // Pointless
} }

View File

@ -343,6 +343,7 @@ NavigationRegion2D::NavigationRegion2D() {
} }
NavigationRegion2D::~NavigationRegion2D() { NavigationRegion2D::~NavigationRegion2D() {
ERR_FAIL_NULL(NavigationServer2D::get_singleton());
NavigationServer2D::get_singleton()->free(region); NavigationServer2D::get_singleton()->free(region);
#ifdef DEBUG_ENABLED #ifdef DEBUG_ENABLED

View File

@ -664,6 +664,7 @@ Polygon2D::Polygon2D() {
Polygon2D::~Polygon2D() { Polygon2D::~Polygon2D() {
// This will free the internally-allocated mesh instance, if allocated. // This will free the internally-allocated mesh instance, if allocated.
ERR_FAIL_NULL(RenderingServer::get_singleton());
RS::get_singleton()->canvas_item_attach_skeleton(get_canvas_item(), RID()); RS::get_singleton()->canvas_item_attach_skeleton(get_canvas_item(), RID());
RS::get_singleton()->free(mesh); RS::get_singleton()->free(mesh);
} }

View File

@ -529,6 +529,7 @@ Bone2D::Bone2D() {
Bone2D::~Bone2D() { Bone2D::~Bone2D() {
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
if (!editor_gizmo_rid.is_null()) { if (!editor_gizmo_rid.is_null()) {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RenderingServer::get_singleton()->free(editor_gizmo_rid); RenderingServer::get_singleton()->free(editor_gizmo_rid);
} }
#endif // TOOLS_ENABLED #endif // TOOLS_ENABLED
@ -803,5 +804,6 @@ Skeleton2D::Skeleton2D() {
} }
Skeleton2D::~Skeleton2D() { Skeleton2D::~Skeleton2D() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RS::get_singleton()->free(skeleton); RS::get_singleton()->free(skeleton);
} }

View File

@ -1108,6 +1108,7 @@ void TileMap::_rendering_update_layer(int p_layer) {
void TileMap::_rendering_cleanup_layer(int p_layer) { void TileMap::_rendering_cleanup_layer(int p_layer) {
ERR_FAIL_INDEX(p_layer, (int)layers.size()); ERR_FAIL_INDEX(p_layer, (int)layers.size());
ERR_FAIL_NULL(RenderingServer::get_singleton());
RenderingServer *rs = RenderingServer::get_singleton(); RenderingServer *rs = RenderingServer::get_singleton();
if (layers[p_layer].canvas_item.is_valid()) { if (layers[p_layer].canvas_item.is_valid()) {
rs->free(layers[p_layer].canvas_item); rs->free(layers[p_layer].canvas_item);
@ -1280,6 +1281,7 @@ void TileMap::_rendering_create_quadrant(TileMapQuadrant *p_quadrant) {
} }
void TileMap::_rendering_cleanup_quadrant(TileMapQuadrant *p_quadrant) { void TileMap::_rendering_cleanup_quadrant(TileMapQuadrant *p_quadrant) {
ERR_FAIL_NULL(RenderingServer::get_singleton());
// Free the canvas items. // Free the canvas items.
for (const RID &ci : p_quadrant->canvas_items) { for (const RID &ci : p_quadrant->canvas_items) {
RenderingServer::get_singleton()->free(ci); RenderingServer::get_singleton()->free(ci);
@ -1596,6 +1598,7 @@ void TileMap::_physics_update_dirty_quadrants(SelfList<TileMapQuadrant>::List &r
void TileMap::_physics_cleanup_quadrant(TileMapQuadrant *p_quadrant) { void TileMap::_physics_cleanup_quadrant(TileMapQuadrant *p_quadrant) {
// Remove a quadrant. // Remove a quadrant.
ERR_FAIL_NULL(PhysicsServer2D::get_singleton());
for (RID body : p_quadrant->bodies) { for (RID body : p_quadrant->bodies) {
bodies_coords.erase(body); bodies_coords.erase(body);
PhysicsServer2D::get_singleton()->free(body); PhysicsServer2D::get_singleton()->free(body);
@ -1754,6 +1757,7 @@ void TileMap::_navigation_update_dirty_quadrants(SelfList<TileMapQuadrant>::List
void TileMap::_navigation_cleanup_quadrant(TileMapQuadrant *p_quadrant) { void TileMap::_navigation_cleanup_quadrant(TileMapQuadrant *p_quadrant) {
// Clear navigation shapes in the quadrant. // Clear navigation shapes in the quadrant.
ERR_FAIL_NULL(NavigationServer2D::get_singleton());
for (const KeyValue<Vector2i, Vector<RID>> &E : p_quadrant->navigation_regions) { for (const KeyValue<Vector2i, Vector<RID>> &E : p_quadrant->navigation_regions) {
for (int i = 0; i < E.value.size(); i++) { for (int i = 0; i < E.value.size(); i++) {
RID region = E.value[i]; RID region = E.value[i];

View File

@ -744,8 +744,10 @@ Camera3D::Camera3D() {
} }
Camera3D::~Camera3D() { Camera3D::~Camera3D() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RenderingServer::get_singleton()->free(camera); RenderingServer::get_singleton()->free(camera);
if (pyramid_shape.is_valid()) { if (pyramid_shape.is_valid()) {
ERR_FAIL_NULL(PhysicsServer3D::get_singleton());
PhysicsServer3D::get_singleton()->free(pyramid_shape); PhysicsServer3D::get_singleton()->free(pyramid_shape);
} }
} }

View File

@ -352,6 +352,8 @@ void CollisionObject3D::_shape_changed(const Ref<Shape3D> &p_shape) {
} }
void CollisionObject3D::_update_debug_shapes() { void CollisionObject3D::_update_debug_shapes() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
if (!is_inside_tree()) { if (!is_inside_tree()) {
debug_shapes_to_update.clear(); debug_shapes_to_update.clear();
return; return;
@ -393,6 +395,8 @@ void CollisionObject3D::_update_debug_shapes() {
} }
void CollisionObject3D::_clear_debug_shapes() { void CollisionObject3D::_clear_debug_shapes() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
for (KeyValue<uint32_t, ShapeData> &E : shapes) { for (KeyValue<uint32_t, ShapeData> &E : shapes) {
ShapeData &shapedata = E.value; ShapeData &shapedata = E.value;
ShapeData::ShapeBase *shape_bases = shapedata.shapes.ptrw(); ShapeData::ShapeBase *shape_bases = shapedata.shapes.ptrw();
@ -627,6 +631,7 @@ int CollisionObject3D::shape_owner_get_shape_index(uint32_t p_owner, int p_shape
} }
void CollisionObject3D::shape_owner_remove_shape(uint32_t p_owner, int p_shape) { void CollisionObject3D::shape_owner_remove_shape(uint32_t p_owner, int p_shape) {
ERR_FAIL_NULL(RenderingServer::get_singleton());
ERR_FAIL_COND(!shapes.has(p_owner)); ERR_FAIL_COND(!shapes.has(p_owner));
ERR_FAIL_INDEX(p_shape, shapes[p_owner].shapes.size()); ERR_FAIL_INDEX(p_shape, shapes[p_owner].shapes.size());
@ -722,5 +727,6 @@ CollisionObject3D::CollisionObject3D() {
} }
CollisionObject3D::~CollisionObject3D() { CollisionObject3D::~CollisionObject3D() {
ERR_FAIL_NULL(PhysicsServer3D::get_singleton());
PhysicsServer3D::get_singleton()->free(rid); PhysicsServer3D::get_singleton()->free(rid);
} }

View File

@ -1701,5 +1701,6 @@ CPUParticles3D::CPUParticles3D() {
} }
CPUParticles3D::~CPUParticles3D() { CPUParticles3D::~CPUParticles3D() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RS::get_singleton()->free(multimesh); RS::get_singleton()->free(multimesh);
} }

View File

@ -254,5 +254,6 @@ Decal::Decal() {
} }
Decal::~Decal() { Decal::~Decal() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RS::get_singleton()->free(decal); RS::get_singleton()->free(decal);
} }

View File

@ -118,5 +118,6 @@ FogVolume::FogVolume() {
} }
FogVolume::~FogVolume() { FogVolume::~FogVolume() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RS::get_singleton()->free(volume); RS::get_singleton()->free(volume);
} }

View File

@ -634,5 +634,6 @@ GPUParticles3D::GPUParticles3D() {
} }
GPUParticles3D::~GPUParticles3D() { GPUParticles3D::~GPUParticles3D() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RS::get_singleton()->free(particles); RS::get_singleton()->free(particles);
} }

View File

@ -58,6 +58,7 @@ GPUParticlesCollision3D::GPUParticlesCollision3D(RS::ParticlesCollisionType p_ty
} }
GPUParticlesCollision3D::~GPUParticlesCollision3D() { GPUParticlesCollision3D::~GPUParticlesCollision3D() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RS::get_singleton()->free(collision); RS::get_singleton()->free(collision);
} }
@ -819,6 +820,7 @@ GPUParticlesAttractor3D::GPUParticlesAttractor3D(RS::ParticlesCollisionType p_ty
set_base(collision); set_base(collision);
} }
GPUParticlesAttractor3D::~GPUParticlesAttractor3D() { GPUParticlesAttractor3D::~GPUParticlesAttractor3D() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RS::get_singleton()->free(collision); RS::get_singleton()->free(collision);
} }

View File

@ -234,6 +234,7 @@ Joint3D::Joint3D() {
} }
Joint3D::~Joint3D() { Joint3D::~Joint3D() {
ERR_FAIL_NULL(PhysicsServer3D::get_singleton());
PhysicsServer3D::get_singleton()->free(joint); PhysicsServer3D::get_singleton()->free(joint);
} }

View File

@ -966,6 +966,7 @@ Label3D::~Label3D() {
TS->free_rid(text_rid); TS->free_rid(text_rid);
ERR_FAIL_NULL(RenderingServer::get_singleton());
RenderingServer::get_singleton()->free(mesh); RenderingServer::get_singleton()->free(mesh);
for (KeyValue<SurfaceKey, SurfaceData> E : surfaces) { for (KeyValue<SurfaceKey, SurfaceData> E : surfaces) {
RenderingServer::get_singleton()->free(E.value.material); RenderingServer::get_singleton()->free(E.value.material);

View File

@ -476,6 +476,7 @@ Light3D::Light3D() {
} }
Light3D::~Light3D() { Light3D::~Light3D() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RS::get_singleton()->instance_set_base(get_instance(), RID()); RS::get_singleton()->instance_set_base(get_instance(), RID());
if (light.is_valid()) { if (light.is_valid()) {

View File

@ -313,6 +313,7 @@ LightmapGIData::LightmapGIData() {
} }
LightmapGIData::~LightmapGIData() { LightmapGIData::~LightmapGIData() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RS::get_singleton()->free(lightmap); RS::get_singleton()->free(lightmap);
} }

View File

@ -204,6 +204,7 @@ NavigationAgent3D::NavigationAgent3D() {
} }
NavigationAgent3D::~NavigationAgent3D() { NavigationAgent3D::~NavigationAgent3D() {
ERR_FAIL_NULL(NavigationServer3D::get_singleton());
NavigationServer3D::get_singleton()->free(agent); NavigationServer3D::get_singleton()->free(agent);
agent = RID(); // Pointless agent = RID(); // Pointless
} }

View File

@ -227,10 +227,12 @@ NavigationLink3D::NavigationLink3D() {
} }
NavigationLink3D::~NavigationLink3D() { NavigationLink3D::~NavigationLink3D() {
ERR_FAIL_NULL(NavigationServer3D::get_singleton());
NavigationServer3D::get_singleton()->free(link); NavigationServer3D::get_singleton()->free(link);
link = RID(); link = RID();
#ifdef DEBUG_ENABLED #ifdef DEBUG_ENABLED
ERR_FAIL_NULL(RenderingServer::get_singleton());
if (debug_instance.is_valid()) { if (debug_instance.is_valid()) {
RenderingServer::get_singleton()->free(debug_instance); RenderingServer::get_singleton()->free(debug_instance);
} }

View File

@ -122,6 +122,7 @@ NavigationObstacle3D::NavigationObstacle3D() {
} }
NavigationObstacle3D::~NavigationObstacle3D() { NavigationObstacle3D::~NavigationObstacle3D() {
ERR_FAIL_NULL(NavigationServer3D::get_singleton());
NavigationServer3D::get_singleton()->free(agent); NavigationServer3D::get_singleton()->free(agent);
agent = RID(); // Pointless agent = RID(); // Pointless
} }

View File

@ -375,12 +375,15 @@ NavigationRegion3D::~NavigationRegion3D() {
if (navigation_mesh.is_valid()) { if (navigation_mesh.is_valid()) {
navigation_mesh->disconnect("changed", callable_mp(this, &NavigationRegion3D::_navigation_changed)); navigation_mesh->disconnect("changed", callable_mp(this, &NavigationRegion3D::_navigation_changed));
} }
ERR_FAIL_NULL(NavigationServer3D::get_singleton());
NavigationServer3D::get_singleton()->free(region); NavigationServer3D::get_singleton()->free(region);
#ifdef DEBUG_ENABLED #ifdef DEBUG_ENABLED
NavigationServer3D::get_singleton_mut()->disconnect("map_changed", callable_mp(this, &NavigationRegion3D::_navigation_map_changed)); NavigationServer3D::get_singleton_mut()->disconnect("map_changed", callable_mp(this, &NavigationRegion3D::_navigation_map_changed));
NavigationServer3D::get_singleton_mut()->disconnect("navigation_debug_changed", callable_mp(this, &NavigationRegion3D::_update_debug_mesh)); NavigationServer3D::get_singleton_mut()->disconnect("navigation_debug_changed", callable_mp(this, &NavigationRegion3D::_update_debug_mesh));
NavigationServer3D::get_singleton_mut()->disconnect("navigation_debug_changed", callable_mp(this, &NavigationRegion3D::_update_debug_edge_connections_mesh)); NavigationServer3D::get_singleton_mut()->disconnect("navigation_debug_changed", callable_mp(this, &NavigationRegion3D::_update_debug_edge_connections_mesh));
ERR_FAIL_NULL(RenderingServer::get_singleton());
if (debug_instance.is_valid()) { if (debug_instance.is_valid()) {
RenderingServer::get_singleton()->free(debug_instance); RenderingServer::get_singleton()->free(debug_instance);
} }

View File

@ -138,6 +138,7 @@ Occluder3D::Occluder3D() {
Occluder3D::~Occluder3D() { Occluder3D::~Occluder3D() {
if (occluder.is_valid()) { if (occluder.is_valid()) {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RS::get_singleton()->free(occluder); RS::get_singleton()->free(occluder);
} }
} }

View File

@ -40,6 +40,7 @@ Path3D::Path3D() {
} }
Path3D::~Path3D() { Path3D::~Path3D() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
if (debug_instance.is_valid()) { if (debug_instance.is_valid()) {
RS::get_singleton()->free(debug_instance); RS::get_singleton()->free(debug_instance);
} }

View File

@ -3358,6 +3358,7 @@ PhysicalBone3D::~PhysicalBone3D() {
if (joint_data) { if (joint_data) {
memdelete(joint_data); memdelete(joint_data);
} }
ERR_FAIL_NULL(PhysicsServer3D::get_singleton());
PhysicsServer3D::get_singleton()->free(joint); PhysicsServer3D::get_singleton()->free(joint);
} }

View File

@ -257,5 +257,6 @@ ReflectionProbe::ReflectionProbe() {
} }
ReflectionProbe::~ReflectionProbe() { ReflectionProbe::~ReflectionProbe() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RS::get_singleton()->free(probe); RS::get_singleton()->free(probe);
} }

View File

@ -58,10 +58,10 @@ Ref<Skin> SkinReference::get_skin() const {
} }
SkinReference::~SkinReference() { SkinReference::~SkinReference() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
if (skeleton_node) { if (skeleton_node) {
skeleton_node->skin_bindings.erase(this); skeleton_node->skin_bindings.erase(this);
} }
RS::get_singleton()->free(skeleton); RS::get_singleton()->free(skeleton);
} }

View File

@ -704,6 +704,7 @@ SoftBody3D::SoftBody3D() :
SoftBody3D::~SoftBody3D() { SoftBody3D::~SoftBody3D() {
memdelete(rendering_server_handler); memdelete(rendering_server_handler);
ERR_FAIL_NULL(PhysicsServer3D::get_singleton());
PhysicsServer3D::get_singleton()->free(physics_rid); PhysicsServer3D::get_singleton()->free(physics_rid);
} }

View File

@ -611,6 +611,7 @@ SpriteBase3D::SpriteBase3D() {
} }
SpriteBase3D::~SpriteBase3D() { SpriteBase3D::~SpriteBase3D() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RenderingServer::get_singleton()->free(mesh); RenderingServer::get_singleton()->free(mesh);
RenderingServer::get_singleton()->free(material); RenderingServer::get_singleton()->free(material);
} }

View File

@ -99,6 +99,7 @@ VisibleOnScreenNotifier3D::VisibleOnScreenNotifier3D() {
VisibleOnScreenNotifier3D::~VisibleOnScreenNotifier3D() { VisibleOnScreenNotifier3D::~VisibleOnScreenNotifier3D() {
RID base_old = get_base(); RID base_old = get_base();
set_base(RID()); set_base(RID());
ERR_FAIL_NULL(RenderingServer::get_singleton());
RS::get_singleton()->free(base_old); RS::get_singleton()->free(base_old);
} }

View File

@ -157,6 +157,7 @@ VisualInstance3D::VisualInstance3D() {
} }
VisualInstance3D::~VisualInstance3D() { VisualInstance3D::~VisualInstance3D() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RenderingServer::get_singleton()->free(instance); RenderingServer::get_singleton()->free(instance);
} }

View File

@ -242,6 +242,7 @@ VoxelGIData::VoxelGIData() {
} }
VoxelGIData::~VoxelGIData() { VoxelGIData::~VoxelGIData() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RS::get_singleton()->free(probe); RS::get_singleton()->free(probe);
} }
@ -516,5 +517,6 @@ VoxelGI::VoxelGI() {
} }
VoxelGI::~VoxelGI() { VoxelGI::~VoxelGI() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RS::get_singleton()->free(voxel_gi); RS::get_singleton()->free(voxel_gi);
} }

View File

@ -1305,6 +1305,7 @@ CanvasItem::CanvasItem() :
} }
CanvasItem::~CanvasItem() { CanvasItem::~CanvasItem() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RenderingServer::get_singleton()->free(canvas_item); RenderingServer::get_singleton()->free(canvas_item);
} }
@ -1459,5 +1460,6 @@ CanvasTexture::CanvasTexture() {
canvas_texture = RS::get_singleton()->canvas_texture_create(); canvas_texture = RS::get_singleton()->canvas_texture_create();
} }
CanvasTexture::~CanvasTexture() { CanvasTexture::~CanvasTexture() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RS::get_singleton()->free(canvas_texture); RS::get_singleton()->free(canvas_texture);
} }

View File

@ -360,5 +360,6 @@ CanvasLayer::CanvasLayer() {
} }
CanvasLayer::~CanvasLayer() { CanvasLayer::~CanvasLayer() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RS::get_singleton()->free(canvas); RS::get_singleton()->free(canvas);
} }

View File

@ -80,6 +80,7 @@ void ViewportTexture::setup_local_to_scene() {
vp->viewport_textures.insert(this); vp->viewport_textures.insert(this);
ERR_FAIL_NULL(RenderingServer::get_singleton());
if (proxy_ph.is_valid()) { if (proxy_ph.is_valid()) {
RS::get_singleton()->texture_proxy_update(proxy, vp->texture_rid); RS::get_singleton()->texture_proxy_update(proxy, vp->texture_rid);
RS::get_singleton()->free(proxy_ph); RS::get_singleton()->free(proxy_ph);
@ -153,6 +154,8 @@ ViewportTexture::~ViewportTexture() {
vp->viewport_textures.erase(this); vp->viewport_textures.erase(this);
} }
ERR_FAIL_NULL(RenderingServer::get_singleton());
if (proxy_ph.is_valid()) { if (proxy_ph.is_valid()) {
RS::get_singleton()->free(proxy_ph); RS::get_singleton()->free(proxy_ph);
} }
@ -301,6 +304,8 @@ void Viewport::_sub_window_remove(Window *p_window) {
int index = _sub_window_find(p_window); int index = _sub_window_find(p_window);
ERR_FAIL_COND(index == -1); ERR_FAIL_COND(index == -1);
ERR_FAIL_NULL(RenderingServer::get_singleton());
RS::get_singleton()->free(gui.sub_windows[index].canvas_item); RS::get_singleton()->free(gui.sub_windows[index].canvas_item);
gui.sub_windows.remove_at(index); gui.sub_windows.remove_at(index);
@ -4117,6 +4122,7 @@ Viewport::~Viewport() {
for (ViewportTexture *E : viewport_textures) { for (ViewportTexture *E : viewport_textures) {
E->vp = nullptr; E->vp = nullptr;
} }
ERR_FAIL_NULL(RenderingServer::get_singleton());
RenderingServer::get_singleton()->free(viewport); RenderingServer::get_singleton()->free(viewport);
} }

View File

@ -135,6 +135,7 @@ CameraAttributes::CameraAttributes() {
} }
CameraAttributes::~CameraAttributes() { CameraAttributes::~CameraAttributes() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RS::get_singleton()->free(camera_attributes); RS::get_singleton()->free(camera_attributes);
} }

View File

@ -294,6 +294,8 @@ CanvasItemMaterial::CanvasItemMaterial() :
CanvasItemMaterial::~CanvasItemMaterial() { CanvasItemMaterial::~CanvasItemMaterial() {
MutexLock lock(material_mutex); MutexLock lock(material_mutex);
ERR_FAIL_NULL(RenderingServer::get_singleton());
if (shader_map.has(current_key)) { if (shader_map.has(current_key)) {
shader_map[current_key].users--; shader_map[current_key].users--;
if (shader_map[current_key].users == 0) { if (shader_map[current_key].users == 0) {

View File

@ -1550,5 +1550,6 @@ Environment::Environment() {
} }
Environment::~Environment() { Environment::~Environment() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RS::get_singleton()->free(environment); RS::get_singleton()->free(environment);
} }

View File

@ -132,6 +132,7 @@ void FogMaterial::_bind_methods() {
void FogMaterial::cleanup_shader() { void FogMaterial::cleanup_shader() {
if (shader.is_valid()) { if (shader.is_valid()) {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RS::get_singleton()->free(shader); RS::get_singleton()->free(shader);
} }
} }

View File

@ -410,5 +410,6 @@ ImmediateMesh::ImmediateMesh() {
mesh = RS::get_singleton()->mesh_create(); mesh = RS::get_singleton()->mesh_create();
} }
ImmediateMesh::~ImmediateMesh() { ImmediateMesh::~ImmediateMesh() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RS::get_singleton()->free(mesh); RS::get_singleton()->free(mesh);
} }

View File

@ -141,6 +141,7 @@ Material::Material() {
} }
Material::~Material() { Material::~Material() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RenderingServer::get_singleton()->free(material); RenderingServer::get_singleton()->free(material);
} }
@ -3005,6 +3006,7 @@ BaseMaterial3D::BaseMaterial3D(bool p_orm) :
} }
BaseMaterial3D::~BaseMaterial3D() { BaseMaterial3D::~BaseMaterial3D() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
MutexLock lock(material_mutex); MutexLock lock(material_mutex);
if (shader_map.has(current_key)) { if (shader_map.has(current_key)) {

View File

@ -2117,6 +2117,7 @@ ArrayMesh::ArrayMesh() {
ArrayMesh::~ArrayMesh() { ArrayMesh::~ArrayMesh() {
if (mesh.is_valid()) { if (mesh.is_valid()) {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RenderingServer::get_singleton()->free(mesh); RenderingServer::get_singleton()->free(mesh);
} }
} }
@ -2132,5 +2133,6 @@ PlaceholderMesh::PlaceholderMesh() {
} }
PlaceholderMesh::~PlaceholderMesh() { PlaceholderMesh::~PlaceholderMesh() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RS::get_singleton()->free(rid); RS::get_singleton()->free(rid);
} }

View File

@ -365,5 +365,6 @@ MultiMesh::MultiMesh() {
} }
MultiMesh::~MultiMesh() { MultiMesh::~MultiMesh() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RenderingServer::get_singleton()->free(multimesh); RenderingServer::get_singleton()->free(multimesh);
} }

View File

@ -1894,6 +1894,7 @@ ParticleProcessMaterial::ParticleProcessMaterial() :
} }
ParticleProcessMaterial::~ParticleProcessMaterial() { ParticleProcessMaterial::~ParticleProcessMaterial() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
MutexLock lock(material_mutex); MutexLock lock(material_mutex);
if (shader_map.has(current_key)) { if (shader_map.has(current_key)) {

View File

@ -340,6 +340,7 @@ PrimitiveMesh::PrimitiveMesh() {
} }
PrimitiveMesh::~PrimitiveMesh() { PrimitiveMesh::~PrimitiveMesh() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RenderingServer::get_singleton()->free(mesh); RenderingServer::get_singleton()->free(mesh);
} }

View File

@ -208,6 +208,7 @@ Shader::Shader() {
} }
Shader::~Shader() { Shader::~Shader() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RenderingServer::get_singleton()->free(shader); RenderingServer::get_singleton()->free(shader);
} }

View File

@ -106,5 +106,6 @@ Sky::Sky() {
} }
Sky::~Sky() { Sky::~Sky() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RS::get_singleton()->free(sky); RS::get_singleton()->free(sky);
} }

View File

@ -324,6 +324,7 @@ ImageTexture::ImageTexture() {}
ImageTexture::~ImageTexture() { ImageTexture::~ImageTexture() {
if (texture.is_valid()) { if (texture.is_valid()) {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RenderingServer::get_singleton()->free(texture); RenderingServer::get_singleton()->free(texture);
} }
} }
@ -630,6 +631,7 @@ PortableCompressedTexture2D::PortableCompressedTexture2D() {}
PortableCompressedTexture2D::~PortableCompressedTexture2D() { PortableCompressedTexture2D::~PortableCompressedTexture2D() {
if (texture.is_valid()) { if (texture.is_valid()) {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RenderingServer::get_singleton()->free(texture); RenderingServer::get_singleton()->free(texture);
} }
} }
@ -1041,6 +1043,7 @@ CompressedTexture2D::CompressedTexture2D() {}
CompressedTexture2D::~CompressedTexture2D() { CompressedTexture2D::~CompressedTexture2D() {
if (texture.is_valid()) { if (texture.is_valid()) {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RS::get_singleton()->free(texture); RS::get_singleton()->free(texture);
} }
} }
@ -1225,6 +1228,7 @@ ImageTexture3D::ImageTexture3D() {
ImageTexture3D::~ImageTexture3D() { ImageTexture3D::~ImageTexture3D() {
if (texture.is_valid()) { if (texture.is_valid()) {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RS::get_singleton()->free(texture); RS::get_singleton()->free(texture);
} }
} }
@ -1386,6 +1390,7 @@ CompressedTexture3D::CompressedTexture3D() {}
CompressedTexture3D::~CompressedTexture3D() { CompressedTexture3D::~CompressedTexture3D() {
if (texture.is_valid()) { if (texture.is_valid()) {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RS::get_singleton()->free(texture); RS::get_singleton()->free(texture);
} }
} }
@ -1911,6 +1916,7 @@ CurveTexture::CurveTexture() {}
CurveTexture::~CurveTexture() { CurveTexture::~CurveTexture() {
if (_texture.is_valid()) { if (_texture.is_valid()) {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RS::get_singleton()->free(_texture); RS::get_singleton()->free(_texture);
} }
} }
@ -2109,6 +2115,7 @@ CurveXYZTexture::CurveXYZTexture() {}
CurveXYZTexture::~CurveXYZTexture() { CurveXYZTexture::~CurveXYZTexture() {
if (_texture.is_valid()) { if (_texture.is_valid()) {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RS::get_singleton()->free(_texture); RS::get_singleton()->free(_texture);
} }
} }
@ -2121,6 +2128,7 @@ GradientTexture1D::GradientTexture1D() {
GradientTexture1D::~GradientTexture1D() { GradientTexture1D::~GradientTexture1D() {
if (texture.is_valid()) { if (texture.is_valid()) {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RS::get_singleton()->free(texture); RS::get_singleton()->free(texture);
} }
} }
@ -2263,6 +2271,7 @@ GradientTexture2D::GradientTexture2D() {
GradientTexture2D::~GradientTexture2D() { GradientTexture2D::~GradientTexture2D() {
if (texture.is_valid()) { if (texture.is_valid()) {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RS::get_singleton()->free(texture); RS::get_singleton()->free(texture);
} }
} }
@ -2521,6 +2530,7 @@ void ProxyTexture::set_base(const Ref<Texture2D> &p_texture) {
base = p_texture; base = p_texture;
if (base.is_valid()) { if (base.is_valid()) {
ERR_FAIL_NULL(RenderingServer::get_singleton());
if (proxy_ph.is_valid()) { if (proxy_ph.is_valid()) {
RS::get_singleton()->texture_proxy_update(proxy, base->get_rid()); RS::get_singleton()->texture_proxy_update(proxy, base->get_rid());
RS::get_singleton()->free(proxy_ph); RS::get_singleton()->free(proxy_ph);
@ -2571,6 +2581,7 @@ ProxyTexture::ProxyTexture() {
} }
ProxyTexture::~ProxyTexture() { ProxyTexture::~ProxyTexture() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
if (proxy_ph.is_valid()) { if (proxy_ph.is_valid()) {
RS::get_singleton()->free(proxy_ph); RS::get_singleton()->free(proxy_ph);
} }
@ -2828,6 +2839,7 @@ AnimatedTexture::AnimatedTexture() {
} }
AnimatedTexture::~AnimatedTexture() { AnimatedTexture::~AnimatedTexture() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RS::get_singleton()->free(proxy); RS::get_singleton()->free(proxy);
RS::get_singleton()->free(proxy_ph); RS::get_singleton()->free(proxy_ph);
} }
@ -3031,6 +3043,7 @@ ImageTextureLayered::ImageTextureLayered(LayeredType p_layered_type) {
ImageTextureLayered::~ImageTextureLayered() { ImageTextureLayered::~ImageTextureLayered() {
if (texture.is_valid()) { if (texture.is_valid()) {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RS::get_singleton()->free(texture); RS::get_singleton()->free(texture);
} }
} }
@ -3198,6 +3211,7 @@ CompressedTextureLayered::CompressedTextureLayered(LayeredType p_type) {
CompressedTextureLayered::~CompressedTextureLayered() { CompressedTextureLayered::~CompressedTextureLayered() {
if (texture.is_valid()) { if (texture.is_valid()) {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RS::get_singleton()->free(texture); RS::get_singleton()->free(texture);
} }
} }
@ -3353,6 +3367,7 @@ CameraTexture::CameraTexture() {}
CameraTexture::~CameraTexture() { CameraTexture::~CameraTexture() {
if (_texture.is_valid()) { if (_texture.is_valid()) {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RenderingServer::get_singleton()->free(_texture); RenderingServer::get_singleton()->free(_texture);
} }
} }
@ -3394,6 +3409,7 @@ PlaceholderTexture2D::PlaceholderTexture2D() {
} }
PlaceholderTexture2D::~PlaceholderTexture2D() { PlaceholderTexture2D::~PlaceholderTexture2D() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RS::get_singleton()->free(rid); RS::get_singleton()->free(rid);
} }
@ -3441,6 +3457,7 @@ PlaceholderTexture3D::PlaceholderTexture3D() {
rid = RS::get_singleton()->texture_3d_placeholder_create(); rid = RS::get_singleton()->texture_3d_placeholder_create();
} }
PlaceholderTexture3D::~PlaceholderTexture3D() { PlaceholderTexture3D::~PlaceholderTexture3D() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RS::get_singleton()->free(rid); RS::get_singleton()->free(rid);
} }
@ -3499,5 +3516,6 @@ PlaceholderTextureLayered::PlaceholderTextureLayered(LayeredType p_type) {
rid = RS::get_singleton()->texture_2d_layered_placeholder_create(RS::TextureLayeredType(layered_type)); rid = RS::get_singleton()->texture_2d_layered_placeholder_create(RS::TextureLayeredType(layered_type));
} }
PlaceholderTextureLayered::~PlaceholderTextureLayered() { PlaceholderTextureLayered::~PlaceholderTextureLayered() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RS::get_singleton()->free(rid); RS::get_singleton()->free(rid);
} }

View File

@ -89,6 +89,9 @@ World2D::World2D() {
} }
World2D::~World2D() { World2D::~World2D() {
ERR_FAIL_NULL(RenderingServer::get_singleton());
ERR_FAIL_NULL(PhysicsServer2D::get_singleton());
ERR_FAIL_NULL(NavigationServer2D::get_singleton());
RenderingServer::get_singleton()->free(canvas); RenderingServer::get_singleton()->free(canvas);
PhysicsServer2D::get_singleton()->free(space); PhysicsServer2D::get_singleton()->free(space);
NavigationServer2D::get_singleton()->free(navigation_map); NavigationServer2D::get_singleton()->free(navigation_map);

View File

@ -157,6 +157,9 @@ World3D::World3D() {
} }
World3D::~World3D() { World3D::~World3D() {
ERR_FAIL_NULL(PhysicsServer3D::get_singleton());
ERR_FAIL_NULL(RenderingServer::get_singleton());
ERR_FAIL_NULL(NavigationServer3D::get_singleton());
PhysicsServer3D::get_singleton()->free(space); PhysicsServer3D::get_singleton()->free(space);
RenderingServer::get_singleton()->free(scenario); RenderingServer::get_singleton()->free(scenario);
NavigationServer3D::get_singleton()->free(navigation_map); NavigationServer3D::get_singleton()->free(navigation_map);

View File

@ -165,6 +165,7 @@ CameraFeed::CameraFeed(String p_name, FeedPosition p_position) {
CameraFeed::~CameraFeed() { CameraFeed::~CameraFeed() {
// Free our textures // Free our textures
ERR_FAIL_NULL(RenderingServer::get_singleton());
RenderingServer::get_singleton()->free(texture[CameraServer::FEED_Y_IMAGE]); RenderingServer::get_singleton()->free(texture[CameraServer::FEED_Y_IMAGE]);
RenderingServer::get_singleton()->free(texture[CameraServer::FEED_CBCR_IMAGE]); RenderingServer::get_singleton()->free(texture[CameraServer::FEED_CBCR_IMAGE]);
} }

View File

@ -60,6 +60,8 @@ void RendererSceneOcclusionCull::HZBuffer::clear() {
if (debug_image.is_valid()) { if (debug_image.is_valid()) {
debug_image.unref(); debug_image.unref();
} }
ERR_FAIL_NULL(RenderingServer::get_singleton());
RS::get_singleton()->free(debug_texture); RS::get_singleton()->free(debug_texture);
} }

View File

@ -123,6 +123,7 @@ XRInterface::XRInterface() {}
XRInterface::~XRInterface() { XRInterface::~XRInterface() {
if (vrs.vrs_texture.is_valid()) { if (vrs.vrs_texture.is_valid()) {
ERR_FAIL_NULL(RenderingServer::get_singleton());
RS::get_singleton()->free(vrs.vrs_texture); RS::get_singleton()->free(vrs.vrs_texture);
vrs.vrs_texture = RID(); vrs.vrs_texture = RID();
} }