mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 02:40:11 +00:00
gdk/surface: Don't leak the EGLSurface
Each time we create a new window, we create a new EGLSurface. Each time we destroy a window, we failed to destroy the EGLSurface, due to passing a GdkDisplay instead of a EGLDisplay to eglDestroySurface(). This effectively leaked not only the EGL surface metadata, but also the associated DMA buffers. For applications where one opens and closes many windows over the lifetime of the application, and where the application runs for a long time; for example a terminal emulator server, this causes a significant memory leak, as the memory will only ever be freed once once the application process itself exits, if ever. Fix this passing an actual EGLDisplay instead of an GdkDisplay, to eglDestroySurface().
This commit is contained in:
parent
8089222fc3
commit
7fd65cc3c1
@ -1132,8 +1132,10 @@ gdk_surface_set_egl_native_window (GdkSurface *self,
|
||||
|
||||
if (priv->egl_surface != NULL)
|
||||
{
|
||||
GdkDisplay *display = gdk_surface_get_display (self);
|
||||
|
||||
gdk_gl_context_clear_current_if_surface (self);
|
||||
eglDestroySurface (gdk_surface_get_display (self), priv->egl_surface);
|
||||
eglDestroySurface (gdk_display_get_egl_display (display), priv->egl_surface);
|
||||
priv->egl_surface = NULL;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user