diff options
Diffstat (limited to 'opengl/libs/EGL/egl_display.cpp')
| -rw-r--r-- | opengl/libs/EGL/egl_display.cpp | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/opengl/libs/EGL/egl_display.cpp b/opengl/libs/EGL/egl_display.cpp index 272fa44..83aafa6 100644 --- a/opengl/libs/EGL/egl_display.cpp +++ b/opengl/libs/EGL/egl_display.cpp @@ -55,19 +55,15 @@ void egl_display_t::addObject(egl_object_t* object) { objects.add(object); } -bool egl_display_t::getObject(egl_object_t* object) { +void egl_display_t::removeObject(egl_object_t* object) { Mutex::Autolock _l(lock); - if (objects.indexOf(object) >= 0) { - object->incRef(); - return true; - } - return false; + objects.remove(object); } -bool egl_display_t::removeObject(egl_object_t* object) { +bool egl_display_t::getObject(egl_object_t* object) { Mutex::Autolock _l(lock); - if (object->decRef() == 1) { - objects.remove(object); + if (objects.indexOf(object) >= 0) { + object->incRef(); return true; } return false; @@ -255,7 +251,18 @@ EGLBoolean egl_display_t::terminate() { } } - // TODO: all egl_object_t should be marked for termination + // Mark all objects remaining in the list as terminated, unless + // there are no reference to them, it which case, we're free to + // delete them. + size_t count = objects.size(); + LOGW_IF(count, "eglTerminate() called w/ %d objects remaining", count); + for (size_t i=0 ; i<count ; i++) { + egl_object_t* o = objects.itemAt(i); + o->destroy(); + } + + // this marks all object handles are "terminated" + objects.clear(); refs--; numTotalConfigs = 0; |
