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

QWindow::winId() crashes when QWindowPrivate::create() fails

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Not Evaluated
    • None
    • 5.15.2, 6.5.1
    • GUI: Window management
    • None
    • Windows

    Description

      Straight forward enough, it is possible for QWindowPrivate::create() to fail.

      QWindow::winId() doesn't check if it is null

      void QWindowPrivate::create(bool recursive, WId nativeHandle)
      ...
      if (!platformWindow) {
      qWarning() << "Failed to create platform window for" << q << "with flags" << q->flags();
      return;
      } 
      
      
      WId QWindow::winId() const{    
          Q_D(const QWindow);
      
          if(!d->platformWindow)
               const_cast<QWindow *>(this)->create();
            
          //No null check
          return d->platformWindow->winId();
      }

      Attachments

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

        Activity

          People

            vestbo Tor Arne Vestbø
            tummon Cathal Tummon
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes