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

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

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.15.2, 6.5.1
    • GUI: Window management
    • None
    • Windows
    • 63824363a (dev), 1a628e82c (6.6), 95e6b2f2b (tqtc/lts-5.15), 2a2db6352 (6.5)

    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:
            3 Start watching this issue

            Dates

              Created:
              Updated: