diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2015-12-18 17:25:17 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-12-18 20:28:40 +0000 |
commit | 3538e039ea82076202ac4b341fc81ffe0d916f21 (patch) | |
tree | 48dd738a57d51880a25bd5303c953f90396730dc /vcl/source | |
parent | 3119440a80282692640378fde5e37974ab63f096 (diff) |
vcl: always re-use context from default window.
This avoids problems with the initial default context getting destroyed.
Change-Id: If465dfcd185a3336036b98cb2a205e0502d3f80b
Reviewed-on: https://gerrit.libreoffice.org/20796
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/app/svdata.cxx | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx index edfdbc9421b8..fbde610f62f0 100644 --- a/vcl/source/app/svdata.cxx +++ b/vcl/source/app/svdata.cxx @@ -113,23 +113,25 @@ void ImplDeInitSVData() delete pSVData->mpPaperNames, pSVData->mpPaperNames = nullptr; } +/// Returns either the application window, or the default GL context window vcl::Window* ImplGetDefaultWindow() { ImplSVData* pSVData = ImplGetSVData(); if ( pSVData->maWinData.mpAppWin ) return pSVData->maWinData.mpAppWin; + else + return ImplGetDefaultContextWindow(); +} - // First test if we already have a default window. - // Don't only place a single if..else inside solar mutex lockframe - // because then we might have to wait for the solar mutex what is not necessary - // if we already have a default window. +/// returns the default window created to hold the persistent VCL GL context. +vcl::Window *ImplGetDefaultContextWindow() +{ + ImplSVData* pSVData = ImplGetSVData(); + // Double check locking on mpDefaultWin. if ( !pSVData->mpDefaultWin ) { - Application::GetSolarMutex().acquire(); - - // Test again because the thread who released the solar mutex could have called - // the same method + SolarMutexGuard aGuard; if ( !pSVData->mpDefaultWin && !pSVData->mbDeInit ) { @@ -142,7 +144,6 @@ vcl::Window* ImplGetDefaultWindow() if( pContext.is() ) pContext->acquire(); } - Application::GetSolarMutex().release(); } return pSVData->mpDefaultWin; |