[Libreoffice-commits] core.git: Branch 'feature/opengl-vcl2' - vcl/source

Louis-Francis Ratté-Boulianne lfrb at collabora.com
Tue Dec 2 07:29:36 PST 2014


 vcl/source/app/svdata.cxx |    8 ++++++++
 vcl/source/app/svmain.cxx |    6 ++++++
 2 files changed, 14 insertions(+)

New commits:
commit 0dc8f568c9c4644542fe9823c2395fd766e1d7d0
Author: Louis-Francis Ratté-Boulianne <lfrb at collabora.com>
Date:   Tue Dec 2 10:29:00 2014 -0500

    vcl: Add reference on default window's context so it doesn't get destroyed
    
    Change-Id: Ifce8903ce75b1d2ff6acfd717c689f8893d80802

diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx
index 0aaff4a..1485305 100644
--- a/vcl/source/app/svdata.cxx
+++ b/vcl/source/app/svdata.cxx
@@ -39,6 +39,7 @@
 #include "vcl/dockwin.hxx"
 #include "salinst.hxx"
 #include "salframe.hxx"
+#include "salgdi.hxx"
 #include "svdata.hxx"
 #include "window.h"
 #include "salimestatus.hxx"
@@ -49,6 +50,8 @@
 
 #include "officecfg/Office/Common.hxx"
 
+#include "vcl/opengl/OpenGLContext.hxx"
+
 #include <stdio.h>
 
 using namespace com::sun::star::uno;
@@ -132,6 +135,11 @@ vcl::Window* ImplGetDefaultWindow()
             DBG_WARNING( "ImplGetDefaultWindow(): No AppWindow" );
             pSVData->mpDefaultWin = new WorkWindow( 0, WB_DEFAULTWIN );
             pSVData->mpDefaultWin->SetText( OUString( "VCL ImplGetDefaultWindow"  ) );
+
+            // Add a reference to the default context so it never gets deleted
+            OpenGLContext* pContext = pSVData->mpDefaultWin->GetGraphics()->GetOpenGLContext();
+            if( pContext )
+                pContext->AddRef();
         }
         Application::GetSolarMutex().release();
     }
diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx
index bd3544b..2fc122c 100644
--- a/vcl/source/app/svmain.cxx
+++ b/vcl/source/app/svmain.cxx
@@ -65,12 +65,15 @@
 #include "outfont.hxx"
 #include "PhysicalFontCollection.hxx"
 #include "print.h"
+#include "salgdi.hxx"
 #include "salsys.hxx"
 #include "saltimer.hxx"
 #include "salimestatus.hxx"
 #include "impimagetree.hxx"
 #include "xconnection.hxx"
 
+#include "vcl/opengl/OpenGLContext.hxx"
+
 #include "osl/process.h"
 #include "com/sun/star/lang/XMultiServiceFactory.hpp"
 #include "com/sun/star/lang/XComponent.hpp"
@@ -448,6 +451,9 @@ void DeInitVCL()
     }
     if ( pSVData->mpDefaultWin )
     {
+        OpenGLContext* pContext = pSVData->mpDefaultWin->GetGraphics()->GetOpenGLContext();
+        if( pContext )
+            pContext->DeRef();
         delete pSVData->mpDefaultWin;
         pSVData->mpDefaultWin = NULL;
     }


More information about the Libreoffice-commits mailing list