From 0bd27f80e0fff56e5450bb10aa7da8ba1ac00406 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Tue, 16 Apr 2019 10:19:27 +0200 Subject: ANGLE: clean up displays on dll unload If the displays are not cleaned up on dll unloading, profilers might report memory leaks. Change-Id: I04cbc3c2448bfb450f7d840e216827f86856e963 Reviewed-by: Friedemann Kleint Reviewed-by: Andre de la Rocha Reviewed-by: Andy Shaw --- src/3rdparty/angle/src/libANGLE/Display.cpp | 17 +++++++++++++++++ src/3rdparty/angle/src/libANGLE/Display.h | 1 + 2 files changed, 18 insertions(+) (limited to 'src/3rdparty/angle/src/libANGLE') diff --git a/src/3rdparty/angle/src/libANGLE/Display.cpp b/src/3rdparty/angle/src/libANGLE/Display.cpp index 735b472787..0bb0bb05b1 100644 --- a/src/3rdparty/angle/src/libANGLE/Display.cpp +++ b/src/3rdparty/angle/src/libANGLE/Display.cpp @@ -364,6 +364,23 @@ Display *Display::GetDisplayFromDevice(Device *device, const AttributeMap &attri return display; } +//static +void Display::CleanupDisplays() +{ + // ~Display takes care of removing the entry from the according map + { + ANGLEPlatformDisplayMap *displays = GetANGLEPlatformDisplayMap(); + while (!displays->empty()) + delete displays->begin()->second; + } + + { + DevicePlatformDisplayMap *displays = GetDevicePlatformDisplayMap(); + while (!displays->empty()) + delete displays->begin()->second; + } +} + Display::Display(EGLenum platform, EGLNativeDisplayType displayId, Device *eglDevice) : mImplementation(nullptr), mDisplayId(displayId), diff --git a/src/3rdparty/angle/src/libANGLE/Display.h b/src/3rdparty/angle/src/libANGLE/Display.h index aa1d1c3b37..2a1c386d75 100644 --- a/src/3rdparty/angle/src/libANGLE/Display.h +++ b/src/3rdparty/angle/src/libANGLE/Display.h @@ -65,6 +65,7 @@ class Display final : angle::NonCopyable static Display *GetDisplayFromDevice(Device *device, const AttributeMap &attribMap); static Display *GetDisplayFromNativeDisplay(EGLNativeDisplayType nativeDisplay, const AttributeMap &attribMap); + static void CleanupDisplays(); static const ClientExtensions &GetClientExtensions(); static const std::string &GetClientExtensionString(); -- cgit v1.2.3