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

Assert in QPainterPath::moveTo() when called after clearing a non-empty path

    XMLWordPrintable

Details

    • 697910e5fbd382e78bc1bcbac3f5824aded059b4 (qt/qtbase/5.13)

    Description

       

      The following sequence will trigger an assert during the second QPainterPath::moveTo() call:

      QPainterPath p;
      p.moveTo(0., 0.);
      p.clear();
      p.moveTo(0., 0.);
      

       

      The second moveTo() triggers this assert:

      QPainterPath::moveTo()
      {
          ...
      
          ensureData();
          detach();
      
          QPainterPathData *d = d_func();
          Q_ASSERT(!d->elements.isEmpty());
      
          ...
      }

      This is because the call to clear() has cleared all the path elements, including the initial MoveTo, but data still exists so it's not re-initialized by the previous ensureData() call.

       

      Maybe QPainterPath::ensureData() shall insert a first null MoveTo element when the d-pointer exists but has empty data (which is the state it's in after a clear).

      Or QPainterPath::clear() shall ensure that the path data contains at least a null MoveTo if it's not null. 

       

      Attachments

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

        Activity

          People

            vgt Eirik Aavitsland
            moretromain Romain Moret
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes