Fix locking scheme for double-clicks

In some cases, the events may be driven in the same thread, which can
lead to a deadlock.  Instead of waiting for the lock, simply refuse to
run if a loading system in in progress.

Fixes https://gitlab.com/kicad/code/kicad/issues/6606

(cherry picked from commit d7a6a2cc71)
This commit is contained in:
Seth Hillbrand 2020-12-03 14:36:57 -08:00
parent 0533a23185
commit 0f9b01ee1d
1 changed files with 4 additions and 1 deletions

View File

@ -597,7 +597,10 @@ int KICAD_MANAGER_CONTROL::ShowPlayer( const TOOL_EVENT& aEvent )
KIWAY_PLAYER* player;
// Prevent multiple KIWAY_PLAYER loading at one time
const std::lock_guard<std::mutex> lock( m_loading );
if( !m_loading.try_lock() )
return -1;
const std::lock_guard<std::mutex> lock( m_loading, std::adopt_lock );
try
{