summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/egl/qegl.cpp3
-rw-r--r--src/gui/egl/qegl_p.h3
2 files changed, 4 insertions, 2 deletions
diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp
index 840b9d6..39291d3 100644
--- a/src/gui/egl/qegl.cpp
+++ b/src/gui/egl/qegl.cpp
@@ -61,6 +61,7 @@ QEglContext::QEglContext()
, cfg(0)
, currentSurface(EGL_NO_SURFACE)
, current(false)
+ , ownsContext(true)
{
}
@@ -206,7 +207,7 @@ void QEglContext::destroySurface(EGLSurface surface)
// Destroy the context. Note: this does not destroy the surface.
void QEglContext::destroy()
{
- if (ctx != EGL_NO_CONTEXT)
+ if (ctx != EGL_NO_CONTEXT && ownsContext)
eglDestroyContext(dpy, ctx);
dpy = EGL_NO_DISPLAY;
ctx = EGL_NO_CONTEXT;
diff --git a/src/gui/egl/qegl_p.h b/src/gui/egl/qegl_p.h
index dc399da..16b5b16 100644
--- a/src/gui/egl/qegl_p.h
+++ b/src/gui/egl/qegl_p.h
@@ -110,7 +110,7 @@ public:
EGLDisplay display() const { return dpy; }
EGLContext context() const { return ctx; }
- void setContext(EGLContext context) { ctx = context; }
+ void setContext(EGLContext context) { ctx = context; ownsContext = false;}
EGLConfig config() const { return cfg; }
void setConfig(EGLConfig config) { cfg = config; }
@@ -131,6 +131,7 @@ private:
EGLConfig cfg;
EGLSurface currentSurface;
bool current;
+ bool ownsContext;
static EGLDisplay getDisplay(QPaintDevice *device);