summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2015-09-08 15:57:55 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2015-09-08 15:47:49 +0000
commit82d25c02f8569aadf166fa92fb581fa68c12fbd1 (patch)
treefc31690a42f22ebdebd9f44a414b8bd5002d4879 /vcl/source
parentf19049065aa3e187377ab73cc70b6faa7803102a (diff)
tdf#94006 - need an explicit dispose for GLContext's SystemChildWindow.
Previously we would get an explicit ~OpenGLContext - and potentially leave FMR's around for other OGC users, now we treat the other users properly - we need an explicit dispose() to get Window::dispose ordering right. Change-Id: I5edcbd73399b6db3dbcfb391570f364f9ab0c70d Reviewed-on: https://gerrit.libreoffice.org/18412 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/opengl/OpenGLContext.cxx9
-rw-r--r--vcl/source/window/openglwin.cxx8
2 files changed, 16 insertions, 1 deletions
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index 432241f03817..f65341a4cbfd 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -112,6 +112,13 @@ OpenGLContext::~OpenGLContext()
assert (mnRefCount == 1);
}
+// release associated child-window if we have one
+void OpenGLContext::dispose()
+{
+ reset();
+ m_pChildWindow.disposeAndClear();
+}
+
rtl::Reference<OpenGLContext> OpenGLContext::Create()
{
return rtl::Reference<OpenGLContext>(new OpenGLContext);
@@ -1191,6 +1198,7 @@ void OpenGLContext::reset()
wglMakeCurrent(NULL, NULL);
wglDeleteContext( m_aGLWin.hRC );
ReleaseDC( m_aGLWin.hWnd, m_aGLWin.hDC );
+ m_aGLWin.hRC = 0;
}
#elif defined( MACOSX )
OpenGLWrapper::resetCurrent();
@@ -1212,6 +1220,7 @@ void OpenGLContext::reset()
if (mbPixmap && m_aGLWin.glPix != None)
glXDestroyPixmap(m_aGLWin.dpy, m_aGLWin.glPix);
+ m_aGLWin.ctx = 0;
}
#endif
}
diff --git a/vcl/source/window/openglwin.cxx b/vcl/source/window/openglwin.cxx
index e07937538d7c..9af4c0ff399b 100644
--- a/vcl/source/window/openglwin.cxx
+++ b/vcl/source/window/openglwin.cxx
@@ -16,7 +16,7 @@ class OpenGLWindowImpl
{
public:
explicit OpenGLWindowImpl(vcl::Window* pWindow);
- ~OpenGLWindowImpl() { mxChildWindow.disposeAndClear(); }
+ ~OpenGLWindowImpl();
OpenGLContext& getContext() { return *mxContext.get(); }
private:
rtl::Reference<OpenGLContext> mxContext;
@@ -33,6 +33,12 @@ OpenGLWindowImpl::OpenGLWindowImpl(vcl::Window* pWindow)
pWindow->SetMouseTransparent(false);
}
+OpenGLWindowImpl::~OpenGLWindowImpl()
+{
+ mxContext->dispose();
+ mxChildWindow.disposeAndClear();
+}
+
OpenGLWindow::OpenGLWindow(vcl::Window* pParent):
Window(pParent, 0),
mxImpl(new OpenGLWindowImpl(this)),