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

QStyleSheetStyle::drawPrimitive(QStyle::PE_PanelLineEdit) crashes with widget==nullptr

    XMLWordPrintable

Details

    • effc8be3ce (qt/qtbase/dev) effc8be3ce (qt/tqtc-qtbase/dev) 1871ac7d12 (qt/qtbase/6.4) e044da9d80 (qt/qtbase/6.3) e044da9d80 (qt/tqtc-qtbase/6.3) 1871ac7d12 (qt/tqtc-qtbase/6.4) 92ea1355d3 (qt/tqtc-qtbase/6.2) c6d365f5d5 (qt/tqtc-qtbase/5.15)

    Description

      Using QStyleSheetStyle::drawPrimitive to draw a QStyle::PE_PanelLineEdit with a nullptr optional widget (i.e. the method default argument for widget parameter) leads to a crash.

      I have attached a simple example to demonstrate the crash - this runs fine in Qt 5.15.2, but crashes in Qt 6.2.4 and 6.3.0 (these are the versions I have easily available). The attached example does not attempt to do anything sensible, it is merely a demonstration of the crash; I discovered it in a much more reasonable scenario and have simplified it to make your debugging life easier.

      I believe it's because of the change made in QTBUG-95631 to use containerWidget(widget) - there is no null pointer check there.

      Attachments

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

        Activity

          People

            axelspoerl Axel Spoerl
            michael.partridge Michael Partridge
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: