summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorqarmin <mikrutrafal54@gmail.com>2020-04-07 19:12:07 +0200
committerqarmin <mikrutrafal54@gmail.com>2020-04-07 19:12:07 +0200
commitb5fd03fc3646bc1c4428072391a11d2307709be9 (patch)
tree2e250af8c868088cebd270f9a9f4222e054138b8
parent1222541c9510d72999c42bf2c934647e95fc0787 (diff)
Free items before finishing rendering server
-rw-r--r--servers/rendering/rendering_server_wrap_mt.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/servers/rendering/rendering_server_wrap_mt.cpp b/servers/rendering/rendering_server_wrap_mt.cpp
index aa3bf583c7..4ca13dbef9 100644
--- a/servers/rendering/rendering_server_wrap_mt.cpp
+++ b/servers/rendering/rendering_server_wrap_mt.cpp
@@ -126,17 +126,6 @@ void RenderingServerWrapMT::init() {
void RenderingServerWrapMT::finish() {
- if (thread) {
-
- command_queue.push(this, &RenderingServerWrapMT::thread_exit);
- Thread::wait_to_finish(thread);
- memdelete(thread);
-
- thread = nullptr;
- } else {
- rendering_server->finish();
- }
-
sky_free_cached_ids();
shader_free_cached_ids();
material_free_cached_ids();
@@ -161,6 +150,17 @@ void RenderingServerWrapMT::finish() {
canvas_item_free_cached_ids();
canvas_light_occluder_free_cached_ids();
canvas_occluder_polygon_free_cached_ids();
+
+ if (thread) {
+
+ command_queue.push(this, &RenderingServerWrapMT::thread_exit);
+ Thread::wait_to_finish(thread);
+ memdelete(thread);
+
+ thread = nullptr;
+ } else {
+ rendering_server->finish();
+ }
}
void RenderingServerWrapMT::set_use_vsync_callback(bool p_enable) {