Loading opengl/libagl/egl.cpp +12 −5 Original line number Original line Diff line number Diff line Loading @@ -147,6 +147,7 @@ struct egl_surface_t EGLDisplay dpy; EGLDisplay dpy; EGLConfig config; EGLConfig config; EGLContext ctx; EGLContext ctx; bool zombie; egl_surface_t(EGLDisplay dpy, EGLConfig config, int32_t depthFormat); egl_surface_t(EGLDisplay dpy, EGLConfig config, int32_t depthFormat); virtual ~egl_surface_t(); virtual ~egl_surface_t(); Loading @@ -173,7 +174,7 @@ protected: egl_surface_t::egl_surface_t(EGLDisplay dpy, egl_surface_t::egl_surface_t(EGLDisplay dpy, EGLConfig config, EGLConfig config, int32_t depthFormat) int32_t depthFormat) : magic(MAGIC), dpy(dpy), config(config), ctx(0) : magic(MAGIC), dpy(dpy), config(config), ctx(0), zombie(false) { { depth.version = sizeof(GGLSurface); depth.version = sizeof(GGLSurface); depth.data = 0; depth.data = 0; Loading Loading @@ -1580,12 +1581,13 @@ EGLBoolean eglDestroySurface(EGLDisplay dpy, EGLSurface eglSurface) if (surface->dpy != dpy) if (surface->dpy != dpy) return setError(EGL_BAD_DISPLAY, EGL_FALSE); return setError(EGL_BAD_DISPLAY, EGL_FALSE); if (surface->ctx) { if (surface->ctx) { // FIXME: this surface is current check what the spec says // defer disconnect/delete until no longer current surface->zombie = true; } else { surface->disconnect(); surface->disconnect(); surface->ctx = 0; } delete surface; delete surface; } } } return EGL_TRUE; return EGL_TRUE; } } Loading Loading @@ -1736,6 +1738,9 @@ EGLBoolean eglMakeCurrent( EGLDisplay dpy, EGLSurface draw, if (c->draw) { if (c->draw) { egl_surface_t* s = reinterpret_cast<egl_surface_t*>(c->draw); egl_surface_t* s = reinterpret_cast<egl_surface_t*>(c->draw); s->disconnect(); s->disconnect(); s->ctx = EGL_NO_CONTEXT; if (s->zombie) delete s; } } if (c->read) { if (c->read) { // FIXME: unlock/disconnect the read surface too // FIXME: unlock/disconnect the read surface too Loading Loading @@ -1777,8 +1782,10 @@ EGLBoolean eglMakeCurrent( EGLDisplay dpy, EGLSurface draw, egl_surface_t* r = (egl_surface_t*)c->read; egl_surface_t* r = (egl_surface_t*)c->read; if (d) { if (d) { c->draw = 0; c->draw = 0; d->ctx = EGL_NO_CONTEXT; d->disconnect(); d->disconnect(); d->ctx = EGL_NO_CONTEXT; if (d->zombie) delete d; } } if (r) { if (r) { c->read = 0; c->read = 0; Loading Loading
opengl/libagl/egl.cpp +12 −5 Original line number Original line Diff line number Diff line Loading @@ -147,6 +147,7 @@ struct egl_surface_t EGLDisplay dpy; EGLDisplay dpy; EGLConfig config; EGLConfig config; EGLContext ctx; EGLContext ctx; bool zombie; egl_surface_t(EGLDisplay dpy, EGLConfig config, int32_t depthFormat); egl_surface_t(EGLDisplay dpy, EGLConfig config, int32_t depthFormat); virtual ~egl_surface_t(); virtual ~egl_surface_t(); Loading @@ -173,7 +174,7 @@ protected: egl_surface_t::egl_surface_t(EGLDisplay dpy, egl_surface_t::egl_surface_t(EGLDisplay dpy, EGLConfig config, EGLConfig config, int32_t depthFormat) int32_t depthFormat) : magic(MAGIC), dpy(dpy), config(config), ctx(0) : magic(MAGIC), dpy(dpy), config(config), ctx(0), zombie(false) { { depth.version = sizeof(GGLSurface); depth.version = sizeof(GGLSurface); depth.data = 0; depth.data = 0; Loading Loading @@ -1580,12 +1581,13 @@ EGLBoolean eglDestroySurface(EGLDisplay dpy, EGLSurface eglSurface) if (surface->dpy != dpy) if (surface->dpy != dpy) return setError(EGL_BAD_DISPLAY, EGL_FALSE); return setError(EGL_BAD_DISPLAY, EGL_FALSE); if (surface->ctx) { if (surface->ctx) { // FIXME: this surface is current check what the spec says // defer disconnect/delete until no longer current surface->zombie = true; } else { surface->disconnect(); surface->disconnect(); surface->ctx = 0; } delete surface; delete surface; } } } return EGL_TRUE; return EGL_TRUE; } } Loading Loading @@ -1736,6 +1738,9 @@ EGLBoolean eglMakeCurrent( EGLDisplay dpy, EGLSurface draw, if (c->draw) { if (c->draw) { egl_surface_t* s = reinterpret_cast<egl_surface_t*>(c->draw); egl_surface_t* s = reinterpret_cast<egl_surface_t*>(c->draw); s->disconnect(); s->disconnect(); s->ctx = EGL_NO_CONTEXT; if (s->zombie) delete s; } } if (c->read) { if (c->read) { // FIXME: unlock/disconnect the read surface too // FIXME: unlock/disconnect the read surface too Loading Loading @@ -1777,8 +1782,10 @@ EGLBoolean eglMakeCurrent( EGLDisplay dpy, EGLSurface draw, egl_surface_t* r = (egl_surface_t*)c->read; egl_surface_t* r = (egl_surface_t*)c->read; if (d) { if (d) { c->draw = 0; c->draw = 0; d->ctx = EGL_NO_CONTEXT; d->disconnect(); d->disconnect(); d->ctx = EGL_NO_CONTEXT; if (d->zombie) delete d; } } if (r) { if (r) { c->read = 0; c->read = 0; Loading