Break wait loops on null TOOL_EVENT
The Wait() function will return a null TOOL_EVENT when the tool stack is shutting down, so we can't just always pass the event, instead we must check for null and end the looping if a null event appears.
This commit is contained in:
parent
6bd3b0afa4
commit
0948d67e56
|
@ -790,7 +790,7 @@ int EDIT_TOOL::FilletTracks( const TOOL_EVENT& aEvent )
|
|||
wxPoint t1newPoint, t2newPoint;
|
||||
|
||||
auto setIfPointOnSeg =
|
||||
[]( wxPoint& aPointToSet, SEG aSegment, VECTOR2I aVecToTest )
|
||||
[]( wxPoint& aPointToSet, SEG aSegment, VECTOR2I aVecToTest )
|
||||
{
|
||||
// Find out if we are within the segment
|
||||
if( ( aSegment.NearestPoint( aVecToTest ) - aVecToTest ).EuclideanNorm()
|
||||
|
@ -1785,7 +1785,13 @@ bool EDIT_TOOL::pickReferencePoint( const wxString& aTooltip, const wxString& aS
|
|||
m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
|
||||
|
||||
while( !done )
|
||||
Wait()->SetPassEvent();
|
||||
{
|
||||
// Pass events unless we receive a null event, then we must shut down
|
||||
if( TOOL_EVENT* evt = Wait() )
|
||||
evt->SetPassEvent();
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
// Ensure statusPopup is hidden after use and before deleting it:
|
||||
m_statusPopup->Hide();
|
||||
|
|
|
@ -331,7 +331,13 @@ int GROUP_TOOL::PickNewMember( const TOOL_EVENT& aEvent )
|
|||
m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
|
||||
|
||||
while( !done )
|
||||
Wait()->SetPassEvent();
|
||||
{
|
||||
// Pass events unless we receive a null event, then we must shut down
|
||||
if( TOOL_EVENT* evt = Wait() )
|
||||
evt->SetPassEvent();
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -184,7 +184,13 @@ int POSITION_RELATIVE_TOOL::SelectPositionRelativeItem( const TOOL_EVENT& aEvent
|
|||
m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
|
||||
|
||||
while( !done )
|
||||
Wait()->SetPassEvent();
|
||||
{
|
||||
// Pass events unless we receive a null event, then we must shut down
|
||||
if( TOOL_EVENT* evt = Wait() )
|
||||
evt->SetPassEvent();
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue