Fix threaded race condition in footprints
The progress reporter should not be cleared in the footprint implementation to prevent dereferencing a NULL. When cancelling the load, we should only allow setting of cancellation to true to prevent a condition where the progress reporter resets the cancellation. Fixes: lp:1774777 * https://bugs.launchpad.net/kicad/+bug/1774777
This commit is contained in:
parent
6e57266136
commit
975e777149
|
@ -137,8 +137,8 @@ bool FOOTPRINT_LIST_IMPL::ReadFootprintFiles( FP_LIB_TABLE* aTable, const wxStri
|
|||
|
||||
while( !m_cancelled && (int)m_count_finished.load() < m_loader->m_total_libs )
|
||||
{
|
||||
if( m_progress_reporter )
|
||||
m_cancelled = !m_progress_reporter->KeepRefreshing();
|
||||
if( m_progress_reporter && !m_progress_reporter->KeepRefreshing() )
|
||||
m_cancelled = true;
|
||||
else
|
||||
wxMilliSleep( 20 );
|
||||
}
|
||||
|
@ -162,8 +162,6 @@ bool FOOTPRINT_LIST_IMPL::ReadFootprintFiles( FP_LIB_TABLE* aTable, const wxStri
|
|||
m_progress_reporter->AdvancePhase();
|
||||
}
|
||||
|
||||
m_progress_reporter = nullptr;
|
||||
|
||||
return m_errors.empty();
|
||||
}
|
||||
|
||||
|
@ -287,8 +285,8 @@ bool FOOTPRINT_LIST_IMPL::JoinWorkers()
|
|||
|
||||
while( !m_cancelled && (size_t)m_count_finished.load() < total_count )
|
||||
{
|
||||
if( m_progress_reporter )
|
||||
m_cancelled = !m_progress_reporter->KeepRefreshing();
|
||||
if( m_progress_reporter && !m_progress_reporter->KeepRefreshing() )
|
||||
m_cancelled = true;
|
||||
else
|
||||
wxMilliSleep( 20 );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue