tpie
tpie copied to clipboard
progress_indicator_base::refresh_impl::m_firstSample used uninitialized
Running tpie/test/unit/ut-internal_priority_queue basic fails on my machine with:
../tpie/tpie/progress_indicator_base.cpp line 38: Assertion failed:
../tpie/tpie/progress_indicator_base.cpp line 38: ptime::seconds: Special ptime
Assertion (false) failed ../tpie/tpie/progress_indicator_base.cpp:38: ptime::seconds: Special ptime
What appears to happen is that:
- A progress_indicator_base is constructed, setting m_current to 0 and range to 2.
- step() is called twice.
- In the second step() call, step >= m_remainingSteps (both == 1), causing call_refresh() to be called.
- Since m_current is now 2, impl->m_firstSample is not initialized.
- ptime::seconds() fails.
Apparently call_refresh() is expected to have been called at a moment when m_current is still 0, but this doesn't happen.
I have not seen this unit test fail on any machine, operating system or compiler with the current version. I cannot seem to find a commit that tried to fix this, but maybe this issue is out-of-date?