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

QQuickItem::mapToItem() can segfault during initalization

    XMLWordPrintable

Details

    • All
    • 08b0e3e39 (dev), 0ae3697cf (6.8)

    Description

      QQuickItem::mapToItem() can crash if called during initialization of the Qml scene while the window is not mapped yet.

      QPointF QQuickItem::mapToItem(const QQuickItem *item, const QPointF &point) const
      {
          QPointF p = mapToScene(point);
          if (item) {
              if (item->window() != window())
                  p = item->window()->mapFromGlobal(window()->mapToGlobal(p));
              p = item->mapFromScene(p);
          }
          return p;
      }
      

      There are two null check missing in

      p = item->window()->mapFromGlobal(window()->mapToGlobal(p));

      .

      Btw, how could that line of code pass code review? It violently violates the SLR principle.

      Attachments

        1. QtBug129500.tar.gz
          1 kB
          Mathias Hasselmann

        Issue Links

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

          Activity

            People

              vestbo Tor Arne Vestbø
              hasselmann_via_meiller Mathias Hasselmann
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes