Kaydet (Commit) 56ece786 authored tarafından Michael Meeks's avatar Michael Meeks Kaydeden (comit) Markus Mohrhard

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/18412Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>

Conflicts:
	vcl/source/window/openglwin.cxx

Change-Id: I5edcbd73399b6db3dbcfb391570f364f9ab0c70d
Reviewed-on: https://gerrit.libreoffice.org/18414Reviewed-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
Tested-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
üst 2fd94938
...@@ -41,6 +41,7 @@ OGLPlayer::~OGLPlayer() ...@@ -41,6 +41,7 @@ OGLPlayer::~OGLPlayer()
{ {
m_xContext->makeCurrent(); m_xContext->makeCurrent();
gltf_renderer_release(m_pHandle); gltf_renderer_release(m_pHandle);
m_xContext->dispose();
} }
releaseInputFiles(); releaseInputFiles();
} }
......
...@@ -92,7 +92,7 @@ namespace oglcanvas ...@@ -92,7 +92,7 @@ namespace oglcanvas
{} {}
SpriteDeviceHelper::~SpriteDeviceHelper() SpriteDeviceHelper::~SpriteDeviceHelper()
{} { mxContext->dispose(); }
void SpriteDeviceHelper::init( vcl::Window& rWindow, void SpriteDeviceHelper::init( vcl::Window& rWindow,
SpriteCanvas& rSpriteCanvas, SpriteCanvas& rSpriteCanvas,
......
...@@ -175,6 +175,7 @@ public: ...@@ -175,6 +175,7 @@ public:
~OpenGLContext(); ~OpenGLContext();
void acquire() { mnRefCount++; } void acquire() { mnRefCount++; }
void release() { if ( --mnRefCount == 0 ) delete this; } void release() { if ( --mnRefCount == 0 ) delete this; }
void dispose();
void requestLegacyContext(); void requestLegacyContext();
void requestSingleBufferedRendering(); void requestSingleBufferedRendering();
......
...@@ -112,6 +112,13 @@ OpenGLContext::~OpenGLContext() ...@@ -112,6 +112,13 @@ OpenGLContext::~OpenGLContext()
assert (mnRefCount == 1); assert (mnRefCount == 1);
} }
// release associated child-window if we have one
void OpenGLContext::dispose()
{
reset();
m_pChildWindow.disposeAndClear();
}
rtl::Reference<OpenGLContext> OpenGLContext::Create() rtl::Reference<OpenGLContext> OpenGLContext::Create()
{ {
return rtl::Reference<OpenGLContext>(new OpenGLContext); return rtl::Reference<OpenGLContext>(new OpenGLContext);
...@@ -1279,6 +1286,7 @@ void OpenGLContext::reset() ...@@ -1279,6 +1286,7 @@ void OpenGLContext::reset()
wglMakeCurrent(NULL, NULL); wglMakeCurrent(NULL, NULL);
wglDeleteContext( m_aGLWin.hRC ); wglDeleteContext( m_aGLWin.hRC );
ReleaseDC( m_aGLWin.hWnd, m_aGLWin.hDC ); ReleaseDC( m_aGLWin.hWnd, m_aGLWin.hDC );
m_aGLWin.hRC = 0;
} }
#elif defined( MACOSX ) #elif defined( MACOSX )
OpenGLWrapper::resetCurrent(); OpenGLWrapper::resetCurrent();
...@@ -1300,6 +1308,7 @@ void OpenGLContext::reset() ...@@ -1300,6 +1308,7 @@ void OpenGLContext::reset()
if (mbPixmap && m_aGLWin.glPix != None) if (mbPixmap && m_aGLWin.glPix != None)
glXDestroyPixmap(m_aGLWin.dpy, m_aGLWin.glPix); glXDestroyPixmap(m_aGLWin.dpy, m_aGLWin.glPix);
m_aGLWin.ctx = 0;
} }
#endif #endif
} }
......
...@@ -15,8 +15,8 @@ ...@@ -15,8 +15,8 @@
class OpenGLWindowImpl class OpenGLWindowImpl
{ {
public: public:
OpenGLWindowImpl(vcl::Window* pWindow); explicit OpenGLWindowImpl(vcl::Window* pWindow);
~OpenGLWindowImpl() { mxChildWindow.disposeAndClear(); } ~OpenGLWindowImpl();
OpenGLContext& getContext() { return *mxContext.get(); } OpenGLContext& getContext() { return *mxContext.get(); }
private: private:
rtl::Reference<OpenGLContext> mxContext; rtl::Reference<OpenGLContext> mxContext;
...@@ -33,6 +33,12 @@ OpenGLWindowImpl::OpenGLWindowImpl(vcl::Window* pWindow) ...@@ -33,6 +33,12 @@ OpenGLWindowImpl::OpenGLWindowImpl(vcl::Window* pWindow)
pWindow->SetMouseTransparent(false); pWindow->SetMouseTransparent(false);
} }
OpenGLWindowImpl::~OpenGLWindowImpl()
{
mxContext->dispose();
mxChildWindow.disposeAndClear();
}
OpenGLWindow::OpenGLWindow(vcl::Window* pParent): OpenGLWindow::OpenGLWindow(vcl::Window* pParent):
Window(pParent, 0), Window(pParent, 0),
mxImpl(new OpenGLWindowImpl(this)), mxImpl(new OpenGLWindowImpl(this)),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment