Try and fix multi-threading issues with the background job widgets
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15377
This commit is contained in:
parent
a6bceb8182
commit
4a54ea3b11
|
@ -305,26 +305,36 @@ void BACKGROUND_JOBS_MONITOR::ShowList( wxWindow* aParent, wxPoint aPos )
|
||||||
|
|
||||||
void BACKGROUND_JOBS_MONITOR::jobUpdated( BACKGROUND_JOB* aJob )
|
void BACKGROUND_JOBS_MONITOR::jobUpdated( BACKGROUND_JOB* aJob )
|
||||||
{
|
{
|
||||||
//for now, we go and update the status bar if its the first job in the vector
|
// this method is called from the reporters from potentially other threads
|
||||||
|
// we have to guard ui calls with CallAfter
|
||||||
|
|
||||||
if( m_jobs.size() > 0 )
|
if( m_jobs.size() > 0 )
|
||||||
{
|
{
|
||||||
|
//for now, we go and update the status bar if its the first job in the vector
|
||||||
if( m_jobs.front() == aJob )
|
if( m_jobs.front() == aJob )
|
||||||
{
|
{
|
||||||
// update all status bar entries
|
// update all status bar entries
|
||||||
for( KISTATUSBAR* statusBar : m_statusBars )
|
for( KISTATUSBAR* statusBar : m_statusBars )
|
||||||
{
|
{
|
||||||
statusBar->ShowBackgroundProgressBar();
|
statusBar->CallAfter(
|
||||||
statusBar->SetBackgroundProgress( aJob->m_currentProgress );
|
[=]()
|
||||||
statusBar->SetBackgroundProgressMax( aJob->m_maxProgress );
|
{
|
||||||
statusBar->SetBackgroundStatusText( aJob->m_status );
|
statusBar->ShowBackgroundProgressBar();
|
||||||
|
statusBar->SetBackgroundProgress( aJob->m_currentProgress );
|
||||||
|
statusBar->SetBackgroundProgressMax( aJob->m_maxProgress );
|
||||||
|
statusBar->SetBackgroundStatusText( aJob->m_status );
|
||||||
|
} );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for( BACKGROUND_JOB_LIST* list : m_shownDialogs )
|
for( BACKGROUND_JOB_LIST* list : m_shownDialogs )
|
||||||
{
|
{
|
||||||
list->UpdateJob( aJob );
|
list->CallAfter(
|
||||||
|
[=]()
|
||||||
|
{
|
||||||
|
list->UpdateJob( aJob );
|
||||||
|
} );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue