diff options
author | Tor Arne Vestbø <tor.arne.vestbo@digia.com> | 2013-12-04 16:38:01 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-12-05 14:06:15 +0100 |
commit | 1782fc1e07619a509ca490b55f0a946537e70b97 (patch) | |
tree | 0179a4c7dff1b0b0e614d91c27b571880e72b652 /src/widgets/widgets/qabstractscrollarea.cpp | |
parent | b86426c81e1c95126ff9b8b84ed5824160c2965b (diff) | |
download | qtbase-1782fc1e07619a509ca490b55f0a946537e70b97.tar.gz |
Prevent recursive resize events in QAbstractScrollArea
During show() of a QAbstractScrollArea we might get resize events, which
results in laying out the children of the scroll area. One of these
children are the scrollbars, and raising them to the top means creating
them, which in turn means creating all parents, including the abstract
scroll area itself. Creating the abstract scroll area means creating
a platform window, which might send synchronous resize events as a
result of creating the window, and we end up recursing.
Change-Id: I1a2813f03091d6c42e51834315835551cb2fd621
Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>
Diffstat (limited to 'src/widgets/widgets/qabstractscrollarea.cpp')
-rw-r--r-- | src/widgets/widgets/qabstractscrollarea.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/widgets/widgets/qabstractscrollarea.cpp b/src/widgets/widgets/qabstractscrollarea.cpp index d8ee923f7a..db4ff8a2b7 100644 --- a/src/widgets/widgets/qabstractscrollarea.cpp +++ b/src/widgets/widgets/qabstractscrollarea.cpp @@ -167,7 +167,7 @@ QT_BEGIN_NAMESPACE QAbstractScrollAreaPrivate::QAbstractScrollAreaPrivate() :hbar(0), vbar(0), vbarpolicy(Qt::ScrollBarAsNeeded), hbarpolicy(Qt::ScrollBarAsNeeded), - shownOnce(false), sizeAdjustPolicy(QAbstractScrollArea::AdjustIgnored), + shownOnce(false), inResize(false), sizeAdjustPolicy(QAbstractScrollArea::AdjustIgnored), viewport(0), cornerWidget(0), left(0), top(0), right(0), bottom(0), xoffset(0), yoffset(0), viewportFilter(0) #ifdef Q_WS_WIN @@ -995,8 +995,12 @@ bool QAbstractScrollArea::event(QEvent *e) d->viewport->setMouseTracking(hasMouseTracking()); break; case QEvent::Resize: + if (!d->inResize) { + d->inResize = true; d->layoutChildren(); - break; + d->inResize = false; + } + break; case QEvent::Show: if (!d->shownOnce && d->sizeAdjustPolicy == QAbstractScrollArea::AdjustToContentsOnFirstShow) { d->sizeHint = QSize(); |