mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-15 02:33:15 +02:00
Guard against div-0 in gauge
This commit is contained in:
parent
9dc76f658d
commit
c842f2700f
@ -189,11 +189,14 @@ void DIALOG_DRC::OnActivateDlg( wxActivateEvent& aEvent )
|
|||||||
// PROGRESS_REPORTER calls
|
// PROGRESS_REPORTER calls
|
||||||
|
|
||||||
bool DIALOG_DRC::updateUI()
|
bool DIALOG_DRC::updateUI()
|
||||||
|
{
|
||||||
|
if( m_maxProgress != 0 )
|
||||||
{
|
{
|
||||||
double cur = std::clamp( (double) m_progress.load() / m_maxProgress, 0.0, 1.0 );
|
double cur = std::clamp( (double) m_progress.load() / m_maxProgress, 0.0, 1.0 );
|
||||||
|
|
||||||
int newValue = KiROUND( cur * 1000.0 );
|
int newValue = KiROUND( cur * 1000.0 );
|
||||||
m_gauge->SetValue( newValue );
|
m_gauge->SetValue( newValue );
|
||||||
|
}
|
||||||
|
|
||||||
// There is significant overhead on at least Windows when updateUi is called constantly thousands of times
|
// There is significant overhead on at least Windows when updateUi is called constantly thousands of times
|
||||||
// in the drc process and safeyieldfor is called each time.
|
// in the drc process and safeyieldfor is called each time.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user