tdf#104893 vcl opengl: fix assert failure when starting chart editing
OpenGLContext::prepareForYield() assumed that in case we have a current
context, then it's the last one, but that's not the case for chart windows
since commit 78b100ec9c
(only init the OpenGL
context if we need it, 2016-06-07), which creates an OpenGLContext instance
(which is then the last one in the context list) but explicitly doesn't
initialize it (so that it would become the current one).
Fix the problem by resetting not the last but the last current context.
Change-Id: Ie0e96927473290590cd6333e5cdcb7daa009431b
Reviewed-on: https://gerrit.libreoffice.org/54495
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
This commit is contained in:
@@ -483,8 +483,19 @@ void OpenGLContext::prepareForYield()
|
||||
|
||||
SAL_INFO("vcl.opengl", "Unbinding contexts in preparation for yield");
|
||||
|
||||
if( pCurrentCtx->isCurrent() )
|
||||
pCurrentCtx->resetCurrent();
|
||||
// Find the first context that is current and reset it.
|
||||
// Usually the last context is the current, but not in case a new
|
||||
// OpenGLContext is created already but not yet initialized.
|
||||
while (pCurrentCtx.is())
|
||||
{
|
||||
if (pCurrentCtx->isCurrent())
|
||||
{
|
||||
pCurrentCtx->resetCurrent();
|
||||
break;
|
||||
}
|
||||
|
||||
pCurrentCtx = pCurrentCtx->mpPrevContext;
|
||||
}
|
||||
|
||||
assert (!hasCurrent());
|
||||
}
|
||||
|
Reference in New Issue
Block a user