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

Garbage collector crashes on mark/drain of generator functions

    XMLWordPrintable

Details

    • Linux/X11
    • d082d8ff76080c8e5aa74414c253014bcf7e79c9

    Description

      This example crashes after clicking the button a few times, because the GC crashes while marking the generator property "gen". I reduced the crash from a larger async code base to this minimal example.

      import QtQuick 2.15
      import QtQuick.Window 2.15
      import QtQuick.Controls 2.2
      Window {
          width: 100
          height: 100
          visible: true    
      
          Component {
              id: textComp
              Item {
                  property var gen: (function*(){ yield 42; })()
                  Component.onCompleted: {
                      gc() // tries to cleanup old object, but crashes with 'gen'
                  }
              }
          } 
         
          Column {
              anchors.fill: parent
              StackView {
                  id: stack
                  width: 100
                  height: 100
                  initialItem: Item { }
              }        
              Button {
                  height: 50
                  width: 100
                  text: "Click"
                  onClicked:  {
                      if(stack.depth > 1)
                          stack.pop()
                      stack.push(textComp)
                  }
              }
          }
      }
      
      

       

      Crashing:

      #3 0x00007ffff7c67971 in QV4::Heap::GeneratorObject::markObjects (b=0x7fffe87144e0, stack=0x7fffffff8120) at src/qml/jsruntime/qv4generatorobject_p.h:97

      Attachments

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

        Activity

          People

            qtqmlteam Qt Qml Team User
            jschaubzes Johannes Schaub
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes