If we didn't use all reserved vertices in OpenGL GAL, show the error to user.

It will cause graphical artifacts, and it's not clear to what's happening if the message is never shown.

See https://gitlab.com/kicad/code/kicad/-/issues/18298
This commit is contained in:
Alex Shvartzkop 2024-06-28 23:15:47 +03:00
parent 9e82d7c93c
commit 0acc4dc286
1 changed files with 16 additions and 6 deletions

View File

@ -81,20 +81,30 @@ bool VERTEX_MANAGER::Reserve( unsigned int aSize )
if( !aSize )
return true;
if( m_reservedSpace != 0 || m_reserved )
wxLogTrace( traceVertexManager, wxS( "Did not use all previous vertices allocated" ) );
// flags to avoid hanging by calling DisplayError too many times:
static bool show_err_reserve = true;
static bool show_err_alloc = true;
// flag to avoid hanging by calling DisplayError too many times:
static bool show_err = true;
if( m_reservedSpace != 0 || m_reserved )
{
if( show_err_reserve )
{
DisplayError(
nullptr,
wxT( "VERTEX_MANAGER::Reserve: Did not use all previous vertices allocated" ) );
show_err_reserve = false;
}
}
m_reserved = m_container->Allocate( aSize );
if( m_reserved == nullptr )
{
if( show_err )
if( show_err_alloc )
{
DisplayError( nullptr, wxT( "VERTEX_MANAGER::Reserve: Vertex allocation error" ) );
show_err = false;
show_err_alloc = false;
}
return false;