diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2016-04-03 12:45:40 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2016-04-03 11:32:11 +0000 |
commit | 8ce657d0279566ef327af1b88339534041ddc012 (patch) | |
tree | 0688da2cf6a8cdc442c937cca011bd1f7b26096f /tests/auto/widgets/dialogs/qfontdialog/qfontdialog.pro | |
parent | bedf0367ac580a2e73712be2f4207bb6af9f0226 (diff) |
QAbstractItemView: don't call restart() on invalid QElapsedTimer
In keyboardSearch(), QAbstractItemView unconditionally called
QElapsedTimer::restart().
Calling restart() on an invalid QElapsedTimer is undefined
behavior:
qelapsedtimer_unix.cpp:192:9: runtime error: signed integer overflow: 3313808 - -9223372036854775808 cannot be represented in type 'long int'
qelapsedtimer_unix.cpp:193:10: runtime error: signed integer overflow: 534150461 - -9223372036854775808 cannot be represented in type 'long int'
qelapsedtimer_unix.cpp:194:17: runtime error: signed integer overflow: -9223372036851462000 * 1000000000 cannot be represented in type 'long long int'
The code already checked the timer for validity, and did not
use the return value of restart() in case of an invalid timer,
but the check came too late.
Fix by checking the return value of QElapsedTimer::isValid()
earlier, and calling start() instead of restart() instead.
Fix the same error in QTreeView, which has a c'n'p copy of
the buggy code.
Change-Id: I9751465394707d9348d5c05a0b1b2be147eceb2e
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Diffstat (limited to 'tests/auto/widgets/dialogs/qfontdialog/qfontdialog.pro')
0 files changed, 0 insertions, 0 deletions