eeschema: Handle broken spin style value
The spin style is stored as a numeric and can be corrupted. We handle
this by triggering assertions for debugging the bad value while
resetting to default if we have non-valid spin values that are outside
the array.
Fixes: lp:1843091
* https://bugs.launchpad.net/kicad/+bug/1843091
(cherry picked from commit c3226653cc
)
This commit is contained in:
parent
6d4dd3e17a
commit
15d1b6cef0
|
@ -45,6 +45,8 @@
|
||||||
#include <netlist_object.h>
|
#include <netlist_object.h>
|
||||||
#include <trace_helpers.h>
|
#include <trace_helpers.h>
|
||||||
|
|
||||||
|
#include <wx/debug.h>
|
||||||
|
|
||||||
|
|
||||||
extern void IncrementLabelMember( wxString& name, int aIncrement );
|
extern void IncrementLabelMember( wxString& name, int aIncrement );
|
||||||
|
|
||||||
|
@ -251,7 +253,10 @@ void SCH_TEXT::SetLabelSpinStyle( int aSpinStyle )
|
||||||
switch( aSpinStyle )
|
switch( aSpinStyle )
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case 0: // Horiz Normal Orientation (left justified)
|
wxASSERT_MSG( 1, "Bad spin style" );
|
||||||
|
case 0: // Horiz Normal Orientation
|
||||||
|
//
|
||||||
|
m_spin_style = 0; // Handle the error spin style by resetting
|
||||||
SetTextAngle( TEXT_ANGLE_HORIZ );
|
SetTextAngle( TEXT_ANGLE_HORIZ );
|
||||||
SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
|
SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
|
||||||
SetVertJustify( GR_TEXT_VJUSTIFY_BOTTOM );
|
SetVertJustify( GR_TEXT_VJUSTIFY_BOTTOM );
|
||||||
|
@ -773,7 +778,10 @@ void SCH_GLOBALLABEL::SetLabelSpinStyle( int aSpinStyle )
|
||||||
switch( aSpinStyle )
|
switch( aSpinStyle )
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
|
wxASSERT_MSG( 1, "Bad spin style" );
|
||||||
case 0: // Horiz Normal Orientation
|
case 0: // Horiz Normal Orientation
|
||||||
|
//
|
||||||
|
m_spin_style = 0; // Handle the error spin style by resetting
|
||||||
SetTextAngle( TEXT_ANGLE_HORIZ );
|
SetTextAngle( TEXT_ANGLE_HORIZ );
|
||||||
SetHorizJustify( GR_TEXT_HJUSTIFY_RIGHT );
|
SetHorizJustify( GR_TEXT_HJUSTIFY_RIGHT );
|
||||||
SetVertJustify( GR_TEXT_VJUSTIFY_CENTER );
|
SetVertJustify( GR_TEXT_VJUSTIFY_CENTER );
|
||||||
|
@ -1037,7 +1045,10 @@ void SCH_HIERLABEL::SetLabelSpinStyle( int aSpinStyle )
|
||||||
switch( aSpinStyle )
|
switch( aSpinStyle )
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
|
wxASSERT_MSG( 1, "Bad spin style" );
|
||||||
case 0: // Horiz Normal Orientation
|
case 0: // Horiz Normal Orientation
|
||||||
|
//
|
||||||
|
m_spin_style = 0; // Handle the error spin style by resetting
|
||||||
SetTextAngle( TEXT_ANGLE_HORIZ );
|
SetTextAngle( TEXT_ANGLE_HORIZ );
|
||||||
SetHorizJustify( GR_TEXT_HJUSTIFY_RIGHT );
|
SetHorizJustify( GR_TEXT_HJUSTIFY_RIGHT );
|
||||||
SetVertJustify( GR_TEXT_VJUSTIFY_CENTER );
|
SetVertJustify( GR_TEXT_VJUSTIFY_CENTER );
|
||||||
|
|
Loading…
Reference in New Issue