Hack to prevent multiple simulation commands from stacking up.

Can happen if someone hammers away on the probe and/or tune tools
without ever mousing over the schematic in between.

*May* fix the below bug.

Fixes https://gitlab.com/kicad/code/kicad/issues/6876
This commit is contained in:
Jeff Young 2021-02-02 01:05:48 +00:00
parent 22aa9132a3
commit 7688fdc94f
3 changed files with 17 additions and 0 deletions

View File

@ -219,3 +219,10 @@ bool TOOL_EVENT::IsMoveTool() const
return( m_commandStr.is_initialized()
&& m_commandStr.get().find( "InteractiveMove" ) != GetCommandStr()->npos );
}
bool TOOL_EVENT::IsSimulator() const
{
return( m_commandStr.is_initialized()
&& m_commandStr.get().find( "Simulation" ) != GetCommandStr()->npos );
}

View File

@ -418,6 +418,11 @@ public:
*/
bool IsMoveTool() const;
/**
* Indicate if the event is from the simulator.
*/
bool IsSimulator() const;
/**
* Return a non-standard parameter assigned to the event. Its meaning depends on the
* target tool.

View File

@ -266,6 +266,11 @@ public:
*/
inline void PostEvent( const TOOL_EVENT& aEvent )
{
// Horrific hack, but it's a crash bug. Don't let inter-frame commands stack up
// waiting to be processed.
if( aEvent.IsSimulator() && m_eventQueue.back().IsSimulator() )
m_eventQueue.pop_back();
m_eventQueue.push_back( aEvent );
}