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

Crash when accessing non-existent parentWidget

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.9.3
    • GUI: Window management
    • None

    Description

      The function QWidget::setVisible(bool) in qwidget.cpp is not implemented uniformly in regard to the parentWidget() property, sometimes there is a pointer check on the return value of this function and sometimes there isn't. Especially line 8250 caused a crash in our case:

       if (isWindow() || parentWidget()->isVisible()) {

      should be:

       if (isWindow() || (parentWidget() && parentWidget()->isVisible())) {

      There are more occurences of using the return value of parentWidget() without a pointer check in QWidget::serVisible(bool):

      QWidget *pw = parentWidget();
      if (!testAttribute(Qt::WA_WState_Created)
          && (isWindow() || pw->testAttribute(Qt::WA_WState_Created))) {
              create();
      }
      

      and

      // adjust size if necessary
              if (!wasResized
                  && (isWindow() || !parentWidget()>d_func()>layout))  {

      Attachments

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

        Activity

          People

            richard Richard Moe Gustavsen
            eddie.mond Eddie Mond
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes