From 537bff8c020c8fd2c150b2821d1cc035ee96f84f Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 1 Dec 2009 16:55:44 +0100 Subject: QWindowStyle: make sure there is no duplicate in the list of scrollbar. Otherwise the list grow and waste memory and CPU each time the stylesheet is changed or the widget is shown Reviewed-by: Thierry Task-number: QTBUG-6409 --- src/gui/styles/qwindowsstyle.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/gui/styles/qwindowsstyle.cpp b/src/gui/styles/qwindowsstyle.cpp index 30f2f35..0a59d6d 100644 --- a/src/gui/styles/qwindowsstyle.cpp +++ b/src/gui/styles/qwindowsstyle.cpp @@ -213,10 +213,12 @@ bool QWindowsStyle::eventFilter(QObject *o, QEvent *e) case QEvent::StyleChange: case QEvent::Show: if (QProgressBar *bar = qobject_cast(o)) { - d->bars << bar; - if (d->bars.size() == 1) { - Q_ASSERT(d->animationFps> 0); - d->animateTimer = startTimer(1000 / d->animationFps); + if (!d->bars.contains(bar)) { + d->bars << bar; + if (d->bars.size() == 1) { + Q_ASSERT(d->animationFps> 0); + d->animateTimer = startTimer(1000 / d->animationFps); + } } } break; -- cgit v0.12