summaryrefslogtreecommitdiff
path: root/vcl/win/source
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-09-10 17:25:27 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-09-11 06:55:54 +0000
commit29ec512e8c00984e13cf24accf81ad7c24d8e877 (patch)
treeffd90a564f48df68a3803ec7b74cc2a418cb8a53 /vcl/win/source
parent9e3820ac21685627f5a411b7fa9f9c944eedb2b8 (diff)
windows opengl: make sure mpLastContext is indeed the current context
There were two problems here: 1) The OpenGLContext ctor registered the instance on the list of contexts, but platform-specific call (e.g. wglMakeCurrent()) was only made later. Add a registerAsCurrent() member function that helps ensuring that the last item in the context list is indeed the current context. 2) OpenGLContext::prepareForYield() is called without the solar mutex being locked, but it still assumes that the last context in the context list is the thread's current context, which may not be true. The result is that during JunitTest_sd_unoapi, we end up in a situation like: debug:4640:5240: OpenGLContext::registerAsCurrent: wglGetCurrentContext() is 00010001, pSVData->maGDIData.mpLastContext is 00FA65F8 debug:4640:7944: OpenGLContext::registerAsCurrent: wglGetCurrentContext() is 000D0003, pSVData->maGDIData.mpLastContext is 00FA6C70 debug:4640:5240: OpenGLContext::prepareForYield: start, wglGetCurrentContext() is 00010001, pSVData->maGDIData.mpLastContext is 00FA6C70 I.e. one thread registers as current, an other registers as current, too (while the other thread has the solar mutex), then once the original thread wants to release the solar mutex, the real current context and the last item in the context list won't match, so the assert at the end of prepareForYield() will fail. Fix this by releasing the GL context in WinSalInstance::DestroyFrame(). With this, JunitTest_sd_unoapi passes on Windows with GL enabled. Change-Id: Icfb9c65c871586b5df69b5a2ab3aa91843dfc799 Reviewed-on: https://gerrit.libreoffice.org/18473 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'vcl/win/source')
-rw-r--r--vcl/win/source/app/salinst.cxx1
1 files changed, 1 insertions, 0 deletions
diff --git a/vcl/win/source/app/salinst.cxx b/vcl/win/source/app/salinst.cxx
index 7458efa20214..392763054e44 100644
--- a/vcl/win/source/app/salinst.cxx
+++ b/vcl/win/source/app/salinst.cxx
@@ -941,6 +941,7 @@ SalFrame* WinSalInstance::CreateFrame( SalFrame* pParent, sal_uLong nSalFrameSty
void WinSalInstance::DestroyFrame( SalFrame* pFrame )
{
+ OpenGLContext::prepareForYield();
SendMessageW( mhComWnd, SAL_MSG_DESTROYFRAME, 0, (LPARAM)pFrame );
}