Commit 68d644fd authored by jean-pierre charras's avatar jean-pierre charras

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 21dd8db7
parent f6e33450
......@@ -165,11 +165,15 @@ void LENGTH_TUNER_TOOL::performTuning()
VECTOR2I end( m_startSnapPoint );
PNS_TUNE_STATUS_POPUP statusPopup( frame() );
statusPopup.Popup();
// Create an instance of PNS_TUNE_STATUS_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 );
updateStatusPopup( statusPopup );
updateStatusPopup( *statusPopup );
while( OPT_TOOL_EVENT evt = Wait() )
{
......@@ -179,7 +183,7 @@ void LENGTH_TUNER_TOOL::performTuning()
{
end = evt->Position();
m_router->Move( end, NULL );
updateStatusPopup( statusPopup );
updateStatusPopup( *statusPopup );
}
else if( evt->IsClick( BUT_LEFT ) )
{
......@@ -195,32 +199,32 @@ void LENGTH_TUNER_TOOL::performTuning()
{
placer->AmplitudeStep( -1 );
m_router->Move( end, NULL );
updateStatusPopup( statusPopup );
updateStatusPopup( *statusPopup );
}
else if( evt->IsAction( &ACT_AmplIncrease ) )
{
placer->AmplitudeStep( 1 );
m_router->Move( end, NULL );
updateStatusPopup( statusPopup );
updateStatusPopup( *statusPopup );
}
else if(evt->IsAction( &ACT_SpacingDecrease ) )
{
placer->SpacingStep( -1 );
m_router->Move( end, NULL );
updateStatusPopup( statusPopup );
updateStatusPopup( *statusPopup );
}
else if( evt->IsAction( &ACT_SpacingIncrease ) )
{
placer->SpacingStep( 1 );
m_router->Move( end, NULL );
updateStatusPopup( statusPopup );
updateStatusPopup( *statusPopup );
}
else if( evt->IsAction( &ACT_Settings ) )
{
statusPopup.Hide();
statusPopup->Hide();
TOOL_EVENT dummy;
meanderSettingsDialog( dummy );
statusPopup.Show();
statusPopup->Show();
}
}
......
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