summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2015-09-08 15:57:55 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-09-11 09:49:53 +0000
commit2c27c810027d8b01237c0f97359a3fadd6455a45 (patch)
treec174331141986d0bed0ac8e874fa361ec9bf30bb
parent3265f2b2ea074965e145496c219360819996d432 (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. Reviewed-on: https://gerrit.libreoffice.org/18412 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com> Conflicts: vcl/source/window/openglwin.cxx Change-Id: I5edcbd73399b6db3dbcfb391570f364f9ab0c70d Reviewed-on: https://gerrit.libreoffice.org/18414 Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com> Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com> Reviewed-on: https://gerrit.libreoffice.org/18445 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--avmedia/source/opengl/oglplayer.cxx1
-rw-r--r--canvas/source/opengl/ogl_spritedevicehelper.cxx2
-rw-r--r--include/vcl/opengl/OpenGLContext.hxx1
-rw-r--r--vcl/source/opengl/OpenGLContext.cxx9
-rw-r--r--vcl/source/window/openglwin.cxx10
5 files changed, 20 insertions, 3 deletions
diff --git a/avmedia/source/opengl/oglplayer.cxx b/avmedia/source/opengl/oglplayer.cxx
index 7d04807b6b72..7ddaa502e1b9 100644
--- a/avmedia/source/opengl/oglplayer.cxx
+++ b/avmedia/source/opengl/oglplayer.cxx
@@ -41,6 +41,7 @@ OGLPlayer::~OGLPlayer()
{
m_xContext->makeCurrent();
gltf_renderer_release(m_pHandle);
+ m_xContext->dispose();
}
releaseInputFiles();
}
diff --git a/canvas/source/opengl/ogl_spritedevicehelper.cxx b/canvas/source/opengl/ogl_spritedevicehelper.cxx
index 091279c27242..e76b86e3f675 100644
--- a/canvas/source/opengl/ogl_spritedevicehelper.cxx
+++ b/canvas/source/opengl/ogl_spritedevicehelper.cxx
@@ -92,7 +92,7 @@ namespace oglcanvas
{}
SpriteDeviceHelper::~SpriteDeviceHelper()
- {}
+ { mxContext->dispose(); }
void SpriteDeviceHelper::init( vcl::Window& rWindow,
SpriteCanvas& rSpriteCanvas,
diff --git a/include/vcl/opengl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx
index 88e9e71c5fa4..98f9c61079d2 100644
--- a/include/vcl/opengl/OpenGLContext.hxx
+++ b/include/vcl/opengl/OpenGLContext.hxx
@@ -175,6 +175,7 @@ public:
~OpenGLContext();
void acquire() { mnRefCount++; }
void release() { if ( --mnRefCount == 0 ) delete this; }
+ void dispose();
void requestLegacyContext();
void requestSingleBufferedRendering();
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index 3b70641433e6..ea9664e43e1f 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);
@@ -1283,6 +1290,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();
@@ -1304,6 +1312,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 37d1ea5b18e6..9af4c0ff399b 100644
--- a/vcl/source/window/openglwin.cxx
+++ b/vcl/source/window/openglwin.cxx
@@ -15,8 +15,8 @@
class OpenGLWindowImpl
{
public:
- OpenGLWindowImpl(vcl::Window* pWindow);
- ~OpenGLWindowImpl() { mxChildWindow.disposeAndClear(); }
+ explicit OpenGLWindowImpl(vcl::Window* pWindow);
+ ~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)),