Commit 4a9dffc3 authored by charras's avatar charras

Fixed in Eeschema a bug that crashed Eeschema after a break wire command

parent cfdb2839
...@@ -134,8 +134,7 @@ void BreakSegmentOnJunction( SCH_SCREEN* Screen ) ...@@ -134,8 +134,7 @@ void BreakSegmentOnJunction( SCH_SCREEN* Screen )
* ( excluding ends) * ( excluding ends)
* fill aPicklist with modified items if non null * fill aPicklist with modified items if non null
*/ */
void BreakSegment(SCH_SCREEN * aScreen, wxPoint aBreakpoint, void BreakSegment(SCH_SCREEN * aScreen, wxPoint aBreakpoint )
PICKED_ITEMS_LIST * aPicklist)
{ {
EDA_DrawLineStruct* segment, * NewSegment; EDA_DrawLineStruct* segment, * NewSegment;
for( SCH_ITEM* DrawList = aScreen->EEDrawList;DrawList; DrawList = DrawList->Next() ) for( SCH_ITEM* DrawList = aScreen->EEDrawList;DrawList; DrawList = DrawList->Next() )
...@@ -153,23 +152,12 @@ void BreakSegment(SCH_SCREEN * aScreen, wxPoint aBreakpoint, ...@@ -153,23 +152,12 @@ void BreakSegment(SCH_SCREEN * aScreen, wxPoint aBreakpoint,
if( (segment->m_Start == aBreakpoint) || (segment->m_End == aBreakpoint ) ) if( (segment->m_Start == aBreakpoint) || (segment->m_End == aBreakpoint ) )
continue; continue;
/* Ici il faut couper le segment en 2 */ /* Ici il faut couper le segment en 2 */
if( aPicklist ) // First: put copy of the old segment in undo list
{
ITEM_PICKER picker((SCH_ITEM*) segment->GenCopy(), UR_CHANGED);
picker.m_Link = segment;
aPicklist->PushItem(picker);
}
NewSegment = segment->GenCopy(); NewSegment = segment->GenCopy();
NewSegment->m_Start = aBreakpoint; NewSegment->m_Start = aBreakpoint;
segment->m_End = NewSegment->m_Start; segment->m_End = NewSegment->m_Start;
NewSegment->SetNext( segment->Next() ); NewSegment->SetNext( segment->Next() );
segment->SetNext( NewSegment ); segment->SetNext( NewSegment );
DrawList = NewSegment; DrawList = NewSegment;
if( aPicklist )
{
ITEM_PICKER picker(NewSegment, UR_NEW);
aPicklist->PushItem(picker);
}
} }
} }
......
...@@ -342,10 +342,8 @@ void BreakSegmentOnJunction( SCH_SCREEN * Screen ); ...@@ -342,10 +342,8 @@ void BreakSegmentOnJunction( SCH_SCREEN * Screen );
/* Break a segment ( BUS, WIRE ) int 2 segments at location aBreakpoint, /* Break a segment ( BUS, WIRE ) int 2 segments at location aBreakpoint,
* if aBreakpoint in on segment segment * if aBreakpoint in on segment segment
* ( excluding ends) * ( excluding ends)
* fill aPicklist with modified items if non null
*/ */
void BreakSegment(SCH_SCREEN * aScreen, wxPoint aBreakpoint, void BreakSegment(SCH_SCREEN * aScreen, wxPoint aBreakpoint );
PICKED_ITEMS_LIST * aPicklist = NULL);
/**************/ /**************/
/* EECLASS.CPP */ /* EECLASS.CPP */
......
...@@ -338,10 +338,10 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -338,10 +338,10 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_BREAK_WIRE: case ID_POPUP_SCH_BREAK_WIRE:
{ {
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
PICKED_ITEMS_LIST picklistForUndo; SCH_ITEM* oldWiresList = screen->ExtractWires( true );
BreakSegment( screen, screen->m_Curseur, &picklistForUndo ); BreakSegment( screen, screen->m_Curseur );
if( picklistForUndo.GetCount() ) if( oldWiresList )
SaveCopyInUndoList( picklistForUndo, UR_UNSPECIFIED ); SaveCopyInUndoList( oldWiresList, UR_WIRE_IMAGE );
TestDanglingEnds( screen->EEDrawList, &dc ); TestDanglingEnds( screen->EEDrawList, &dc );
} }
break; break;
......
No preview for this file type
This diff is collapsed.
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