Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-21092

QScrollArea with setWidgetResizable(true) on Mac OS X runs endless recursion when resizing wigdet.

    XMLWordPrintable

Details

    • macOS

    Description

      Endless recursion runs on Mac OS X (tested on 10.7) when setting QScrollArea::widgetResizable to true, adding widget and setting its minimum size hint greater than corresponding maximum size hint.

      Code to reproduce:
      QScrollArea* scrollArea = new QScrollArea();
      scrollArea->setWidgetResizable (true); //true, not false;
      QWidget* widget = new QWidget();
      widget->setMinimumHeight(100);
      widget->setMaximumHeight(120);
      scrollArea->setWidget(widget);
      someParentLayout->addWidget(scrollArea);
      ...
      widget->setMinimumHeight(125); //BOOM

      QScrollArea calls updateScrollBars, updateScrollBars tries to adjust widget's size, it causes repaint, repaint causes updateScrollBars call etc etc.

      Here just a small part of call stack, bug is too easy to reproduce, so I believe dump is not needed:

      Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
      0 Test 0x00000001007f8d94 QStyleSheetStyle::renderRule(QWidget const*, QStyleOption const*, int) const + 92
      1 Test 0x00000001007e1cac QStyleSheetStyle::pixelMetric(QStyle::PixelMetric, QStyleOption const*, QWidget const*) const + 260
      2 Test 0x0000000100a37ca0 QScrollBar::sizeHint() const + 190
      3 Test 0x0000000100a973b4 QAbstractScrollArea::maximumViewportSize() const + 76
      4 Test 0x0000000100aa544d QScrollAreaPrivate::updateScrollBars() + 153
      5 Test 0x0000000100aa5bbc QScrollArea::eventFilter(QObject*, QEvent*) + 124
      6 Test 0x0000000100f10e4f QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) + 247
      7 Test 0x0000000100108d81 QApplicationPrivate::notify_helper(QObject*, QEvent*) + 397
      8 Test 0x000000010010d308 QApplication::notify(QObject*, QEvent*) + 17702
      9 Test 0x0000000100f149ac QCoreApplication::notifyInternal(QObject*, QEvent*) + 208
      10 Test 0x0000000100f1e0f1 QCoreApplication::sendEvent(QObject*, QEvent*) + 81
      11 Test 0x000000010004ce71 QWidgetPrivate::setGeometry_sys_helper(int, int, int, int, bool) + 2267
      12 Test 0x0000000100052bba QWidgetPrivate::setGeometry_sys(int, int, int, int, bool) + 2704
      13 Test 0x00000001001c8b65 QWidget::resize(QSize const&) + 239
      14 Test 0x0000000100aa596b QScrollAreaPrivate::updateScrollBars() + 1463
      15 Test 0x0000000100aa5bbc QScrollArea::eventFilter(QObject*, QEvent*) + 124
      16 Test 0x0000000100f10e4f QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) + 247
      17 Test 0x0000000100108d81 QApplicationPrivate::notify_helper(QObject*, QEvent*) + 397
      18 Test 0x000000010010d308 QApplication::notify(QObject*, QEvent*) + 17702
      19 Test 0x0000000100f149ac QCoreApplication::notifyInternal(QObject*, QEvent*) + 208
      20 Test 0x0000000100f1e0f1 QCoreApplication::sendEvent(QObject*, QEvent*) + 81
      21 Test 0x000000010004ce71 QWidgetPrivate::setGeometry_sys_helper(int, int, int, int, bool) + 2267
      22 Test 0x0000000100052bba QWidgetPrivate::setGeometry_sys(int, int, int, int, bool) + 2704
      23 Test 0x00000001001c8b65 QWidget::resize(QSize const&) + 239
      24 Test 0x0000000100aa596b QScrollAreaPrivate::updateScrollBars() + 1463
      25 Test 0x0000000100aa5bbc QScrollArea::eventFilter(QObject*, QEvent*) + 124
      26 Test 0x0000000100f10e4f QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) + 247
      27 Test 0x0000000100108d81 QApplicationPrivate::notify_helper(QObject*, QEvent*) + 397
      28 Test 0x000000010010d308 QApplication::notify(QObject*, QEvent*) + 17702
      29 Test 0x0000000100f149ac QCoreApplication::notifyInternal(QObject*, QEvent*) + 208
      30 Test 0x0000000100f1e0f1 QCoreApplication::sendEvent(QObject*, QEvent*) + 81
      31 Test 0x000000010004ce71 QWidgetPrivate::setGeometry_sys_helper(int, int, int, int, bool) + 2267
      32 Test 0x0000000100052bba QWidgetPrivate::setGeometry_sys(int, int, int, int, bool) + 2704
      33 Test 0x00000001001c8b65 QWidget::resize(QSize const&) + 239
      34 Test 0x0000000100aa596b QScrollAreaPrivate::updateScrollBars() + 1463
      ...

      Attachments

        1. qtbug21092.zip
          2 kB
          Friedemann Kleint

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              Unassigned Unassigned
              sergei.nevdakh Sergei Nevdakh
              Votes:
              2 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes