From cf868df93f628e56301b0064dffd32c469fd3bb1 Mon Sep 17 00:00:00 2001 From: Deve Date: Sun, 13 Aug 2017 01:03:13 +0200 Subject: [PATCH] Fixed memory leaks in wayland device --- .../source/Irrlicht/CIrrDeviceWayland.cpp | 44 ++++++++++++++++--- 1 file changed, 39 insertions(+), 5 deletions(-) diff --git a/lib/irrlicht/source/Irrlicht/CIrrDeviceWayland.cpp b/lib/irrlicht/source/Irrlicht/CIrrDeviceWayland.cpp index 8493ecf5a..6ceff83f3 100644 --- a/lib/irrlicht/source/Irrlicht/CIrrDeviceWayland.cpp +++ b/lib/irrlicht/source/Irrlicht/CIrrDeviceWayland.cpp @@ -715,6 +715,9 @@ CIrrDeviceWayland::CIrrDeviceWayland(const SIrrlichtCreationParameters& params) CIrrDeviceWayland::~CIrrDeviceWayland() { delete m_egl_context; + + if (m_egl_window) + wl_egl_window_destroy(m_egl_window); if (m_keyboard) wl_keyboard_destroy(m_keyboard); @@ -730,15 +733,46 @@ CIrrDeviceWayland::~CIrrDeviceWayland() if (m_shell_surface) wl_shell_surface_destroy(m_shell_surface); + + if (m_surface) + wl_surface_destroy(m_surface); + + if (m_shell) + wl_shell_destroy(m_shell); + + if (m_shm) + wl_shm_destroy(m_shm); + + if (m_compositor) + wl_compositor_destroy(m_compositor); + + if (m_output) + wl_output_destroy(m_output); + + if (m_seat) + wl_seat_destroy(m_seat); + + if (m_registry) + wl_registry_destroy(m_registry); + + if (m_xkb_state) + xkb_state_unref(m_xkb_state); + + if (m_xkb_keymap) + xkb_keymap_unref(m_xkb_keymap); + + if (m_xkb_compose_state) + xkb_compose_state_unref(m_xkb_compose_state); + + if (m_xkb_compose_table) + xkb_compose_table_unref(m_xkb_compose_table); + + if (m_xkb_context) + xkb_context_unref(m_xkb_context); - wl_output_destroy(m_output); - wl_seat_destroy(m_seat); - wl_registry_destroy(m_registry); wl_display_flush(m_display); wl_display_disconnect(m_display); - xkb_context_unref(m_xkb_context); - closeJoysticks(); }