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

QQuickItem::mapToItem() can segfault during initalization

XMLWordPrintable

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

      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.

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

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes