Fix GL assertion failure during GAL teardown

This commit is contained in:
Chris Pavlina 2017-03-06 17:30:24 -05:00
parent 3854637ec5
commit 11f4622ea5
1 changed files with 7 additions and 1 deletions

View File

@ -2,6 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2016 CERN
* Copyright (C) 2017 KiCad Developers, see AUTHORS.txt for contributors.
* @author Maciej Suminski <maciej.suminski@cern.ch>
*
* This program is free software; you can redistribute it and/or
@ -78,7 +79,12 @@ void GL_CONTEXT_MANAGER::LockCtx( wxGLContext* aContext, wxGLCanvas* aCanvas )
m_glCtxMutex.lock();
wxGLCanvas* canvas = aCanvas ? aCanvas : m_glContexts.at( aContext );
canvas->SetCurrent( *aContext );
// Prevent assertion failure in wxGLContext::SetCurrent during GAL teardown
if( canvas->GetXWindow() )
{
canvas->SetCurrent( *aContext );
}
m_glCtx = aContext;
}