From 8b0c6c4a8dc1899d56e52fe3b0a9e1165c30ecae Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Wed, 30 Jun 2010 18:02:23 +0800 Subject: egl: Store screens in a dynamic array. --- src/gallium/state_trackers/egl/common/egl_g3d.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c b/src/gallium/state_trackers/egl/common/egl_g3d.c index d7a2aa8b8ea..4815a8a3222 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d.c @@ -424,11 +424,18 @@ static struct native_event_handler egl_g3d_native_event_handler = { egl_g3d_new_sw_screen }; +static void +egl_g3d_free_screen(void *scr) +{ + struct egl_g3d_screen *gscr = egl_g3d_screen((_EGLScreen *) scr); + FREE(gscr->native_modes); + FREE(gscr); +} + static EGLBoolean egl_g3d_terminate(_EGLDriver *drv, _EGLDisplay *dpy) { struct egl_g3d_display *gdpy = egl_g3d_display(dpy); - EGLint i; _eglReleaseDisplayResources(drv, dpy); _eglCleanupDisplay(dpy); @@ -437,12 +444,8 @@ egl_g3d_terminate(_EGLDriver *drv, _EGLDisplay *dpy) gdpy->pipe->destroy(gdpy->pipe); if (dpy->Screens) { - for (i = 0; i < dpy->NumScreens; i++) { - struct egl_g3d_screen *gscr = egl_g3d_screen(dpy->Screens[i]); - FREE(gscr->native_modes); - FREE(gscr); - } - FREE(dpy->Screens); + _eglDestroyArray(dpy->Screens, egl_g3d_free_screen); + dpy->Screens = NULL; } if (gdpy->smapi) -- cgit v1.2.3