summaryrefslogtreecommitdiffstats
path: root/src/egl/main
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2009-08-10 15:13:42 +0800
committerBrian Paul <[email protected]>2009-08-11 22:14:35 -0600
commit413969a92052c019bcf3c5bf48cf564613eba598 (patch)
tree41dd20b8ab9fbd3319a54340aeadae4bfdb7bdb2 /src/egl/main
parent621801abd287238f9a3209554bc84fec5d2e9ccd (diff)
egl: Implement _eglFiniDisplay.
_eglFiniDisplay is called at exit time to free allocated displays. It is, however, not used right now. Signed-off-by: Chia-I Wu <[email protected]>
Diffstat (limited to 'src/egl/main')
-rw-r--r--src/egl/main/egldisplay.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c
index 58d935225c6..6fdb3b7a1c4 100644
--- a/src/egl/main/egldisplay.c
+++ b/src/egl/main/egldisplay.c
@@ -13,6 +13,7 @@
#include "eglhash.h"
#include "eglstring.h"
#include "eglmutex.h"
+#include "egllog.h"
static _EGL_DECLARE_MUTEX(_eglDisplayInitMutex);
@@ -29,7 +30,22 @@ _eglFiniDisplay(void)
{
_eglLockMutex(&_eglDisplayInitMutex);
if (_eglDisplayHash) {
- /* XXX TODO walk over table entries, deleting each */
+ EGLuint key = _eglHashFirstEntry(_eglDisplayHash);
+
+ while (key) {
+ _EGLDisplay *dpy = (_EGLDisplay *)
+ _eglHashLookup(_eglDisplayHash, key);
+ assert(dpy);
+
+ if (dpy->ContextList || dpy->SurfaceList)
+ _eglLog(_EGL_DEBUG, "Display %u is destroyed with resources", key);
+
+ _eglCleanupDisplay(dpy);
+ free(dpy);
+
+ key = _eglHashNextEntry(_eglDisplayHash, key);
+ }
+
_eglDeleteHashTable(_eglDisplayHash);
_eglDisplayHash = NULL;
_eglDeleteHashTable(_eglSurfaceHash);