From 3f7e0d5302ed0fadd794a41af6e476d2c408adc7 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Thu, 16 Jul 2009 21:21:57 -0700 Subject: egl: Destroy display's resources upon termination. eglTerminate should destroy the contexts and surfaces of the display. Signed-off-by: Chia-I Wu --- src/egl/main/egldisplay.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'src/egl/main/egldisplay.c') diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c index 1f1f41ea71..89de609d0b 100644 --- a/src/egl/main/egldisplay.c +++ b/src/egl/main/egldisplay.c @@ -120,6 +120,38 @@ _eglFindDisplay(NativeDisplayType nativeDisplay) } +/** + * Destroy the contexts and surfaces that are linked to the display. + */ +void +_eglReleaseDisplayResources(_EGLDriver *drv, EGLDisplay dpy) +{ + _EGLDisplay *display; + _EGLContext *contexts; + _EGLSurface *surfaces; + + display = _eglLookupDisplay(dpy); + if (!display) + return; + contexts = display->ContextList; + surfaces = display->SurfaceList; + + while (contexts) { + EGLContext handle = _eglGetContextHandle(contexts); + contexts = contexts->Next; + drv->API.DestroyContext(drv, dpy, handle); + } + assert(!display->ContextList); + + while (surfaces) { + EGLSurface handle = _eglGetSurfaceHandle(surfaces); + surfaces = surfaces->Next; + drv->API.DestroySurface(drv, dpy, handle); + } + assert(!display->SurfaceList); +} + + /** * Free all the data hanging of an _EGLDisplay object, but not * the object itself. -- cgit v1.2.3