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

QQuickWidget crashes on delete when it sets itself as a context property.

    XMLWordPrintable

Details

    Description

      When a QQuickWidget has a context property as itself, the program crashes when the QQuickWidget is deleted.

      * thread #1: tid = 0xd347c, 0x00000001017ac00b QtQml_debug`QQmlData::destroyed(this=0x0000000104b4af60, object=0x0000000104b45df0) + 59 at qqmlengine.cpp:1583, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x50)
          frame #0: 0x00000001017ac00b QtQml_debug`QQmlData::destroyed(this=0x0000000104b4af60, object=0x0000000104b45df0) + 59 at qqmlengine.cpp:1583
         1579	
         1580	void QQmlData::destroyed(QObject *object)
         1581	{
         1582	    if (nextContextObject)
      -> 1583	        nextContextObject->prevContextObject = prevContextObject;
         1584	    if (prevContextObject)
         1585	        *prevContextObject = nextContextObject;
         1586	
         1587	    QQmlAbstractBinding *binding = bindings;
      
      main.cpp
      #include <QApplication>
      #include <QQmlContext>
      #include <QQuickWidget>
      
      int main(int argc, char** argv)
      {
          QApplication app(argc, argv);
      
          QQuickWidget* widget = new QQuickWidget();
          widget->rootContext()->setContextProperty("widget", widget);
          widget->setSource(QUrl("qrc:/widget.qml"));
          widget->deleteLater();
      
          return app.exec();
      }
      
      widget.qml
      import QtQuick 2.2
      
      Rectangle {
          Connections {
              target: widget
          }
      }
      

      Attachments

        Issue Links

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

          Activity

            People

              srutledg Shawn Rutledge
              dwchung Dan Chung
              Votes:
              3 Vote for this issue
              Watchers:
              17 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes