summaryrefslogtreecommitdiffstats
path: root/opengl/libs/EGL/egl_object.h
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2011-11-13 20:50:07 -0800
committerMathias Agopian <mathias@google.com>2011-11-14 17:40:21 -0800
commit274e03c90ee6054e81a16b1bd0a54258e08ddee9 (patch)
tree1ec08e7176e5253e7561d373e35cf572a1bafe18 /opengl/libs/EGL/egl_object.h
parent6b228af6ff20b3f592db4ad5662e1bc401d09b4d (diff)
downloadframeworks_base-274e03c90ee6054e81a16b1bd0a54258e08ddee9.zip
frameworks_base-274e03c90ee6054e81a16b1bd0a54258e08ddee9.tar.gz
frameworks_base-274e03c90ee6054e81a16b1bd0a54258e08ddee9.tar.bz2
fix crash when validating an invalid EGL objects
the code that validated EGL objects dereferenced the object to access its EGLDisplay -- needed for validation (!). This was wrong for two reasons, first we dereferenced the object before validating it (potentially leading to a crash), secondly we didn't validate that the object existed in the right EGLDisplay. We now use the EGLDisplay passed by the user API. Change-Id: I66f9e851d4f8507892a6b1fee3065f124c4e7138
Diffstat (limited to 'opengl/libs/EGL/egl_object.h')
-rw-r--r--opengl/libs/EGL/egl_object.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/opengl/libs/EGL/egl_object.h b/opengl/libs/EGL/egl_object.h
index 46f7139..df1b261 100644
--- a/opengl/libs/EGL/egl_object.h
+++ b/opengl/libs/EGL/egl_object.h
@@ -52,10 +52,11 @@ public:
inline int32_t incRef() { return android_atomic_inc(&count); }
inline int32_t decRef() { return android_atomic_dec(&count); }
+ inline egl_display_t* getDisplay() const { return display; }
private:
void terminate();
- bool get();
+ static bool get(egl_display_t const* display, egl_object_t* object);
public:
template <typename N, typename T>
@@ -66,9 +67,9 @@ public:
public:
~LocalRef();
explicit LocalRef(egl_object_t* rhs);
- explicit LocalRef(T o) : ref(0) {
+ explicit LocalRef(egl_display_t const* display, T o) : ref(0) {
egl_object_t* native = reinterpret_cast<N*>(o);
- if (o && native->get()) {
+ if (o && egl_object_t::get(display, native)) {
ref = native;
}
}