mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-13 17:53:11 +02:00
Gerbview: fix a maximum number (50) of Error messages in report list.
Having a lot of errors can happen when trying to open a non gerber files (this is easy when loading a zip archive). With a *lot* of errors (if a large .step file is found) Gerbview can hang. Fixes https://gitlab.com/kicad/code/kicad/-/issues/20799
This commit is contained in:
parent
38ee4359eb
commit
d5cf541974
@ -112,6 +112,20 @@ GERBER_FILE_IMAGE::~GERBER_FILE_IMAGE()
|
||||
}
|
||||
|
||||
|
||||
void GERBER_FILE_IMAGE::AddMessageToList( const wxString& aMessage )
|
||||
{
|
||||
/* Add a message to the message list, but only if there are less than max_messages
|
||||
* to avoid very long list (can happens if trying to read a non gerber file)
|
||||
*/
|
||||
const int max_messages = 50; // Arbitrary but reasonable value.
|
||||
|
||||
if( m_messagesList.size() < max_messages )
|
||||
m_messagesList.Add( aMessage );
|
||||
else if( m_messagesList.size() == max_messages )
|
||||
m_messagesList.Add( _( "Too many messages, some are skipped" ) );
|
||||
}
|
||||
|
||||
|
||||
void GERBER_FILE_IMAGE::SetDrawOffetAndRotation( VECTOR2D aOffsetMM, EDA_ANGLE aRotation )
|
||||
{
|
||||
m_DisplayOffset.x = KiROUND( aOffsetMM.x * gerbIUScale.IU_PER_MM );
|
||||
|
@ -212,10 +212,7 @@ public:
|
||||
/**
|
||||
* Add a message to the message list
|
||||
*/
|
||||
void AddMessageToList( const wxString& aMessage )
|
||||
{
|
||||
m_messagesList.Add( aMessage );
|
||||
}
|
||||
void AddMessageToList( const wxString& aMessage );
|
||||
|
||||
/**
|
||||
* Return the current coordinate type pointed to by XnnYnn Text (XnnnnYmmmm).
|
||||
|
@ -323,7 +323,7 @@ bool GERBER_FILE_IMAGE::LoadGerberFile( const wxString& aFullFileName )
|
||||
break;
|
||||
|
||||
default:
|
||||
msg.Printf( wxT( "Unexpected char 0x%2.2X" ), *text );
|
||||
msg.Printf( wxT( "Unexpected char 0x%2.2X (%c)" ), *text, *text );
|
||||
AddMessageToList( msg );
|
||||
text++;
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user