[Libreoffice-commits] core.git: Branch 'libreoffice-5-0-2' - avmedia/source canvas/source include/vcl vcl/source

Michael Meeks michael.meeks at collabora.com
Fri Sep 11 02:50:17 PDT 2015


 avmedia/source/opengl/oglplayer.cxx             |    1 +
 canvas/source/opengl/ogl_spritedevicehelper.cxx |    2 +-
 include/vcl/opengl/OpenGLContext.hxx            |    1 +
 vcl/source/opengl/OpenGLContext.cxx             |    9 +++++++++
 vcl/source/window/openglwin.cxx                 |   10 ++++++++--
 5 files changed, 20 insertions(+), 3 deletions(-)

New commits:
commit 2c27c810027d8b01237c0f97359a3fadd6455a45
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Tue Sep 8 15:57:55 2015 +0100

    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 at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    
    Conflicts:
    	vcl/source/window/openglwin.cxx
    
    Change-Id: I5edcbd73399b6db3dbcfb391570f364f9ab0c70d
    Reviewed-on: https://gerrit.libreoffice.org/18414
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    Reviewed-on: https://gerrit.libreoffice.org/18445
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/avmedia/source/opengl/oglplayer.cxx b/avmedia/source/opengl/oglplayer.cxx
index 7d04807..7ddaa50 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 091279c..e76b86e 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 88e9e71..98f9c61 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 3b70641..ea9664e 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 37d1ea5..9af4c0f 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)),


More information about the Libreoffice-commits mailing list