[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - vcl/inc vcl/opengl vcl/source vcl/win

Michael Meeks michael.meeks at collabora.com
Tue Sep 1 07:33:57 PDT 2015


 vcl/inc/openglgdiimpl.hxx           |    2 ++
 vcl/inc/salgdiimpl.hxx              |    2 ++
 vcl/opengl/gdiimpl.cxx              |   13 +++++++++++++
 vcl/source/opengl/OpenGLContext.cxx |    3 +++
 vcl/win/source/gdi/salgdi.cxx       |    2 ++
 vcl/win/source/gdi/salvd.cxx        |    2 +-
 6 files changed, 23 insertions(+), 1 deletion(-)

New commits:
commit eb9e5a863336f9c1a28f5ad59d7e143b16b543fe
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Tue Sep 1 15:09:25 2015 +0100

    tdf#93839 - Encourage vdevs to pick up new GL Contexts when they go invalid.
    
    Change-Id: I21726d0dd052fdc87e8dd36ff7122518325f6313
    Reviewed-on: https://gerrit.libreoffice.org/18242
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/vcl/inc/openglgdiimpl.hxx b/vcl/inc/openglgdiimpl.hxx
index 1809476..2ed88f1 100644
--- a/vcl/inc/openglgdiimpl.hxx
+++ b/vcl/inc/openglgdiimpl.hxx
@@ -154,6 +154,8 @@ public:
 
     virtual void Init() SAL_OVERRIDE;
 
+    virtual void DeInit() SAL_OVERRIDE;
+
     virtual void freeResources() SAL_OVERRIDE;
 
     const vcl::Region& getClipRegion() const;
diff --git a/vcl/inc/salgdiimpl.hxx b/vcl/inc/salgdiimpl.hxx
index aa08cf0..b29405d 100644
--- a/vcl/inc/salgdiimpl.hxx
+++ b/vcl/inc/salgdiimpl.hxx
@@ -46,6 +46,8 @@ public:
 
     virtual void Init() = 0;
 
+    virtual void DeInit() {}
+
     virtual void freeResources() = 0;
 
     virtual bool setClipRegion( const vcl::Region& ) = 0;
diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index 7d71d8b..0b31dd6 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -149,6 +149,19 @@ void OpenGLSalGraphicsImpl::Init()
     }
 }
 
+// Currently only used to get windows ordering right.
+void OpenGLSalGraphicsImpl::DeInit()
+{
+    // tdf#93839:
+    // Our window handles and resources are being free underneath us.
+    // These can be bound into a context, which relies on them. So
+    // let it know. Other eg. VirtualDevice contexts which have
+    // references on and rely on this context continuing to work will
+    // get a shiny new context in AcquireContext:: next PreDraw.
+    if( mpContext && !IsOffscreen() )
+        mpContext->reset();
+}
+
 void OpenGLSalGraphicsImpl::PreDraw()
 {
     OpenGLZone::enter();
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index 4f39bef..c4ff6d8 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -1253,6 +1253,9 @@ void OpenGLContext::reset()
 
     OpenGLZone aZone;
 
+    // don't reset a context in the middle of stack frames rendering to it
+    assert( mnPainting == 0 );
+
     // reset the clip region
     maClipRegion.SetEmpty();
 
diff --git a/vcl/win/source/gdi/salgdi.cxx b/vcl/win/source/gdi/salgdi.cxx
index 64d4952..99cebee 100644
--- a/vcl/win/source/gdi/salgdi.cxx
+++ b/vcl/win/source/gdi/salgdi.cxx
@@ -502,6 +502,8 @@ void WinSalGraphics::DeInitGraphics()
         SelectBrush( getHDC(), mhDefBrush );
     if ( mhDefFont )
         SelectFont( getHDC(), mhDefFont );
+
+    mpImpl->DeInit();
 }
 
 HDC ImplGetCachedDC( sal_uLong nID, HBITMAP hBmp )
diff --git a/vcl/win/source/gdi/salvd.cxx b/vcl/win/source/gdi/salvd.cxx
index ac01d92..2a492b8 100644
--- a/vcl/win/source/gdi/salvd.cxx
+++ b/vcl/win/source/gdi/salvd.cxx
@@ -181,7 +181,7 @@ WinSalVirtualDevice::~WinSalVirtualDevice()
     // destroy saved DC
     if( mpGraphics->getDefPal() )
         SelectPalette( mpGraphics->getHDC(), mpGraphics->getDefPal(), TRUE );
-    mpGraphics->InitGraphics();
+    mpGraphics->DeInitGraphics();
     if( mhDefBmp )
         SelectBitmap( mpGraphics->getHDC(), mhDefBmp );
     if( !mbForeignDC )


More information about the Libreoffice-commits mailing list