Commit 82dff765 authored by jean-pierre charras's avatar jean-pierre charras

Eeschema: fix minor bugs #1450107 and #1450104 (assertion failures, only visible in Debug mode)

parent 81ea3ce4
......@@ -211,9 +211,7 @@ bool LIB_EDIT_FRAME::LoadOneLibraryPartAux( LIB_ALIAS* aEntry, PART_LIB* aLibrar
wxString cmpName = m_aliasName = aEntry->GetName();
LIB_ALIAS* alias = (LIB_ALIAS*) aEntry;
LIB_PART* lib_part = alias->GetPart();
LIB_PART* lib_part = aEntry->GetPart();
wxASSERT( lib_part );
......
......@@ -181,9 +181,7 @@ END_EVENT_TABLE()
LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH_LIB_EDITOR, _( "Library Editor" ),
wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, GetLibEditFrameName() ),
m_my_part( 0 ),
m_tempCopyComponent( 0 )
wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, GetLibEditFrameName() )
{
wxASSERT( aParent );
......@@ -196,6 +194,9 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_editPinsPerPartOrConvert = false;
m_repeatPinStep = DEFAULT_REPEAT_OFFSET_PIN;
m_my_part = NULL;
m_tempCopyComponent = NULL;
// Delayed initialization
if( m_textSize == -1 )
m_textSize = GetDefaultTextSize();
......@@ -231,6 +232,27 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
ReCreateMenuBar();
ReCreateHToolbar();
ReCreateVToolbar();
// Ensure the current alias name is valid if a part is loaded
// Sometimes it is not valid. This is the case
// when a part value (the part lib name), or the alias list was modified
// during a previous session and the modifications not saved in lib.
// Reopen libedit in a new session gives a non valid m_aliasName
// because the curr part is reloaded from the library (and this is the unmodified part)
// and the old alias name (from the previous edition) can be invalid
LIB_PART* part = GetCurPart();
if( part == NULL )
m_aliasName.Empty();
else if( m_aliasName != part->GetName() )
{
LIB_ALIAS* alias = part->GetAlias( m_aliasName );
if( !alias )
m_aliasName = part->GetName();
}
CreateOptionToolbar();
DisplayLibInfos();
DisplayCmpDoc();
......@@ -278,6 +300,8 @@ LIB_EDIT_FRAME::~LIB_EDIT_FRAME()
delete m_tempCopyComponent;
delete m_my_part;
m_my_part = NULL;
m_tempCopyComponent = NULL;
}
const wxChar* LIB_EDIT_FRAME::GetLibEditFrameName()
......
......@@ -973,7 +973,13 @@ void SCH_EDIT_FRAME::OnEditItem( wxCommandEvent& aEvent )
EditImage( (SCH_BITMAP*) item );
break;
default:
case SCH_LINE_T: // These items have no param to edit
case SCH_MARKER_T:
case SCH_JUNCTION_T:
case SCH_NO_CONNECT_T:
break;
default: // Unexpected item
wxFAIL_MSG( wxString::Format( wxT( "Cannot edit schematic item type %s." ),
GetChars( item->GetClass() ) ) );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment