From 51a74b53cb404f331c20cf687205d8fd8fd3588c Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sat, 29 Sep 2018 12:58:18 +0200 Subject: [PATCH] Pcbnew: Crash after running external plugin Happens only in Opengl mode. So enforce controls in 3 group function: DrawGroup, ChangeGroupColor, ChangeGroupDepth. Fixes: lp:1795044 https://bugs.launchpad.net/kicad/+bug/1795044 --- common/gal/opengl/opengl_gal.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/common/gal/opengl/opengl_gal.cpp b/common/gal/opengl/opengl_gal.cpp index e97462c29f..159d5a2f9c 100644 --- a/common/gal/opengl/opengl_gal.cpp +++ b/common/gal/opengl/opengl_gal.cpp @@ -1288,19 +1288,22 @@ void OPENGL_GAL::EndGroup() void OPENGL_GAL::DrawGroup( int aGroupNumber ) { - cachedManager->DrawItem( *groups[aGroupNumber] ); + if( groups[aGroupNumber] ) + cachedManager->DrawItem( *groups[aGroupNumber] ); } void OPENGL_GAL::ChangeGroupColor( int aGroupNumber, const COLOR4D& aNewColor ) { - cachedManager->ChangeItemColor( *groups[aGroupNumber], aNewColor ); + if( groups[aGroupNumber] ) + cachedManager->ChangeItemColor( *groups[aGroupNumber], aNewColor ); } void OPENGL_GAL::ChangeGroupDepth( int aGroupNumber, int aDepth ) { - cachedManager->ChangeItemDepth( *groups[aGroupNumber], aDepth ); + if( groups[aGroupNumber] ) + cachedManager->ChangeItemDepth( *groups[aGroupNumber], aDepth ); }