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

[REG 6.2.1 -> 6.4β2] QML onLineLaidOut crashes

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • P1: Critical
    • None
    • 6.4.0 Beta2
    • None

    Description

       

      We recently upgraded from Qt 6.2.1 to Qt 6.4 Beta 2, and something stopped working.

      onLineLaidOut() sometimes crashes now.

      Here's the qml:
      main.qml:

      Item {
          id: mainItem
      }

      TestWindow.qml:

      ApplicationWindow {    
          id: appWindow
          visible: true    
          Text {
              id: test
              text: "crashing label"
              onLineLaidOut: ( line ) => {
                  console.log( "visible: " + visible )
                  console.log( "number: " + line.number )
                  console.log( "x: " + line.x )
                  console.log( "y: " + line.y )
                  console.log( "w: " + line.width )
                  console.log( "h: " + line.height )
                  console.log( "isLast: " + line.isLast )
                  console.log( "implicitWidth: " + line.implicitWidth )
              }
          }
      }

      Here's how I instanciate it

      _engine = new QQmlApplicationEngine();
      
      _engine->load( "qrc:/Quick/main.qml" );
       
      QQmlComponent component( _engine, "qrc:/Quick/TestWindow.qml" ); 
      component.create( nullptr );
      
      

       

      Here's the output:

       

      The first time:

      qml: visible: true
      qml: number: 0
      qml: x: 0
      qml: y: 0
      qml: w: 8388607
      qml: h: 16
      qml: isLast: true
      qml: implicitWidth: 72.90625

      and the second time:

      qml: visible: true
      qml: number: -1476398904

       

      and then it crashes.

      Depending on what I put first (x(), isLast, implicitWidth, ...), I get a slightly different stack, and they all point to saying that "eng" (text line engine?) got deleted at some point.

      Here's one stack example:

      Interesting find

      While trying to strip down to the minimum the code to reproduce the crash, I stumbled upon something interesting.

      In my code above, if I created another dummy AppWindow (visible: false), and then 2nd (and 3rd and so on) AppWindow didn't have the crash and everything is fine.

      So for some reason, the 1st instanciated AppWindow has a different behavior.

      For example:

       

      QQmlComponent component( _engine, "qrc:/Quick/TestWindow.qml" ); // (where visible  is false)
      component.create( nullptr );
      
      
      QQmlComponent component2( _engine, "qrc:/Quick/TestWindow.qml" );
      QQuickWindow *w = qobject_cast<QQuickWindow *>( component2.create( nullptr ) );
      
      w->show();
      

      I really don't understand why, but that's what I have observed.

      Attachments

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

        Activity

          People

            santhoshkumar Santhosh Kumar Selvaraj
            mgamsby Martin Gamsby
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 4 hours
                4h

                Gerrit Reviews

                  There are no open Gerrit changes