summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-04-16 11:09:01 +0200
committerGitHub <noreply@github.com>2020-04-16 11:09:01 +0200
commit4989beb3536db0031117532e0a80e73e94ffae43 (patch)
tree35011a87cbace70d64d9d4b885bdcda0fe757a5a
parent08464ea73c18fa6b30abdad5f8e4b2b13f53f118 (diff)
parent943ec798592e20446ae3661cb76c44a20c8a30ec (diff)
Merge pull request #37895 from qarmin/more_leak_fixes
Fixes leaks in ResourceCache, Vulkan and X11
-rw-r--r--core/resource.cpp3
-rw-r--r--drivers/vulkan/rendering_device_vulkan.cpp5
-rw-r--r--drivers/vulkan/vulkan_context.cpp9
-rw-r--r--platform/linuxbsd/display_server_x11.cpp5
4 files changed, 21 insertions, 1 deletions
diff --git a/core/resource.cpp b/core/resource.cpp
index d1883d8043..8d5c441b21 100644
--- a/core/resource.cpp
+++ b/core/resource.cpp
@@ -477,6 +477,9 @@ void ResourceCache::clear() {
resources.clear();
memdelete(lock);
+#ifdef TOOLS_ENABLED
+ memdelete(path_cache_lock);
+#endif
}
void ResourceCache::reload_externals() {
diff --git a/drivers/vulkan/rendering_device_vulkan.cpp b/drivers/vulkan/rendering_device_vulkan.cpp
index 4de2c88008..2769469838 100644
--- a/drivers/vulkan/rendering_device_vulkan.cpp
+++ b/drivers/vulkan/rendering_device_vulkan.cpp
@@ -7274,6 +7274,11 @@ void RenderingDeviceVulkan::finalize() {
vertex_formats.erase(temp);
}
+ for (int i = 0; i < framebuffer_formats.size(); i++) {
+ vkDestroyRenderPass(device, framebuffer_formats[i].render_pass, nullptr);
+ }
+ framebuffer_formats.clear();
+
//all these should be clear at this point
ERR_FAIL_COND(descriptor_pools.size());
ERR_FAIL_COND(dependency_map.size());
diff --git a/drivers/vulkan/vulkan_context.cpp b/drivers/vulkan/vulkan_context.cpp
index 16227367ab..0ce9ccce4c 100644
--- a/drivers/vulkan/vulkan_context.cpp
+++ b/drivers/vulkan/vulkan_context.cpp
@@ -1503,6 +1503,15 @@ VulkanContext::~VulkanContext() {
if (queue_props) {
free(queue_props);
}
+ for (uint32_t i = 0; i < FRAME_LAG; i++) {
+ vkDestroyFence(device, fences[i], nullptr);
+ vkDestroySemaphore(device, image_acquired_semaphores[i], nullptr);
+ vkDestroySemaphore(device, draw_complete_semaphores[i], nullptr);
+ if (separate_present_queue) {
+ vkDestroySemaphore(device, image_ownership_semaphores[i], nullptr);
+ }
+ }
+ DestroyDebugUtilsMessengerEXT(inst, dbg_messenger, nullptr);
vkDestroyDevice(device, nullptr);
vkDestroyInstance(inst, nullptr);
}
diff --git a/platform/linuxbsd/display_server_x11.cpp b/platform/linuxbsd/display_server_x11.cpp
index 6049dbf4d6..78ddef5ff6 100644
--- a/platform/linuxbsd/display_server_x11.cpp
+++ b/platform/linuxbsd/display_server_x11.cpp
@@ -1471,8 +1471,11 @@ DisplayServer::WindowMode DisplayServerX11::window_get_mode(WindowID p_window) c
if (result == Success && data) {
long *state = (long *)data;
- if (state[0] == WM_IconicState)
+ if (state[0] == WM_IconicState) {
+ XFree(data);
return WINDOW_MODE_MINIMIZED;
+ }
+ XFree(data);
}
}