P&S router: length tuning tool: fix a crash after trying to tune a track.
It happens on Windows, and wxWidgets 3.1.3. It is created by
PNS_TUNE_STATUS_POPUP instance used in tool. I am pretty sure this crash is
created by the stack switching when managing events, due to some changes in
wxWidgets code.
The fix creates the instance on the heap, instead of on the stack.
This is not the first time I see this kind of issue.
From master, commit 21dd8db
This commit is contained in:
parent
f6e33450ff
commit
68d644fd28
|
@ -165,11 +165,15 @@ void LENGTH_TUNER_TOOL::performTuning()
|
||||||
|
|
||||||
VECTOR2I end( m_startSnapPoint );
|
VECTOR2I end( m_startSnapPoint );
|
||||||
|
|
||||||
PNS_TUNE_STATUS_POPUP statusPopup( frame() );
|
// Create an instance of PNS_TUNE_STATUS_POPUP.
|
||||||
statusPopup.Popup();
|
// DO NOT create it on the stack: otherwise on Windows, wxWidgets 3.1.3
|
||||||
|
// it creates a crash. I am pretty sure this crash is created by the stack switching
|
||||||
|
// when managing events (JPC).
|
||||||
|
std::unique_ptr<PNS_TUNE_STATUS_POPUP> statusPopup( new PNS_TUNE_STATUS_POPUP( frame() ) );
|
||||||
|
statusPopup->Popup();
|
||||||
|
|
||||||
m_router->Move( end, NULL );
|
m_router->Move( end, NULL );
|
||||||
updateStatusPopup( statusPopup );
|
updateStatusPopup( *statusPopup );
|
||||||
|
|
||||||
while( OPT_TOOL_EVENT evt = Wait() )
|
while( OPT_TOOL_EVENT evt = Wait() )
|
||||||
{
|
{
|
||||||
|
@ -179,7 +183,7 @@ void LENGTH_TUNER_TOOL::performTuning()
|
||||||
{
|
{
|
||||||
end = evt->Position();
|
end = evt->Position();
|
||||||
m_router->Move( end, NULL );
|
m_router->Move( end, NULL );
|
||||||
updateStatusPopup( statusPopup );
|
updateStatusPopup( *statusPopup );
|
||||||
}
|
}
|
||||||
else if( evt->IsClick( BUT_LEFT ) )
|
else if( evt->IsClick( BUT_LEFT ) )
|
||||||
{
|
{
|
||||||
|
@ -195,32 +199,32 @@ void LENGTH_TUNER_TOOL::performTuning()
|
||||||
{
|
{
|
||||||
placer->AmplitudeStep( -1 );
|
placer->AmplitudeStep( -1 );
|
||||||
m_router->Move( end, NULL );
|
m_router->Move( end, NULL );
|
||||||
updateStatusPopup( statusPopup );
|
updateStatusPopup( *statusPopup );
|
||||||
}
|
}
|
||||||
else if( evt->IsAction( &ACT_AmplIncrease ) )
|
else if( evt->IsAction( &ACT_AmplIncrease ) )
|
||||||
{
|
{
|
||||||
placer->AmplitudeStep( 1 );
|
placer->AmplitudeStep( 1 );
|
||||||
m_router->Move( end, NULL );
|
m_router->Move( end, NULL );
|
||||||
updateStatusPopup( statusPopup );
|
updateStatusPopup( *statusPopup );
|
||||||
}
|
}
|
||||||
else if(evt->IsAction( &ACT_SpacingDecrease ) )
|
else if(evt->IsAction( &ACT_SpacingDecrease ) )
|
||||||
{
|
{
|
||||||
placer->SpacingStep( -1 );
|
placer->SpacingStep( -1 );
|
||||||
m_router->Move( end, NULL );
|
m_router->Move( end, NULL );
|
||||||
updateStatusPopup( statusPopup );
|
updateStatusPopup( *statusPopup );
|
||||||
}
|
}
|
||||||
else if( evt->IsAction( &ACT_SpacingIncrease ) )
|
else if( evt->IsAction( &ACT_SpacingIncrease ) )
|
||||||
{
|
{
|
||||||
placer->SpacingStep( 1 );
|
placer->SpacingStep( 1 );
|
||||||
m_router->Move( end, NULL );
|
m_router->Move( end, NULL );
|
||||||
updateStatusPopup( statusPopup );
|
updateStatusPopup( *statusPopup );
|
||||||
}
|
}
|
||||||
else if( evt->IsAction( &ACT_Settings ) )
|
else if( evt->IsAction( &ACT_Settings ) )
|
||||||
{
|
{
|
||||||
statusPopup.Hide();
|
statusPopup->Hide();
|
||||||
TOOL_EVENT dummy;
|
TOOL_EVENT dummy;
|
||||||
meanderSettingsDialog( dummy );
|
meanderSettingsDialog( dummy );
|
||||||
statusPopup.Show();
|
statusPopup->Show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue