CreateWindowContainer causing crash with deleteChildren



  • I am embedding a QML application within a QML widget with the following code:

    @QQuickView *qView;
    if ( mQMLMap.contains( name ) )
    return;
    qView = new QQuickView();
    if ( !floating )
    {
    //I've also tried using just QWidget::createWindowContainer( qView, mpMainFrame )
    QWidget *container = mpMainFrame->createWindowContainer( qView );
    container->setParent( mpMainFrame );
    //container->setAttribute( Qt::WA_DeleteOnClose );
    container->setGeometry(x, y, width, height);
    container->show();
    }
    qView->setBaseSize(QSize(width,height));
    mQMLMap[name] = qView;
    QQmlContext *ct = qView->rootContext();
    ct->setContextProperty("Lua", this);
    qView->setSource(QUrl::fromLocalFile(source));
    QList<QQmlError> errors = qView->errors();
    for(int i=0;i<errors.size();i++){
    QQmlError err = errors[i];
    TDebug(QColor(Qt::white),QColor(Qt::red))<<"QML ERROR:"<<err.description();
    }
    qView->show();@

    The issue is the floating window versus an embedded window. If the window is floating (ie createWindowContainer is never called), everything works well. However, if the window is embedded via createWindowContainer, when the application is exited, the following backtrace comes up:

    bq. #0 0x00007ffff5abb444 in QWidget::~QWidget() () from /home/chris/Qt5.1.1/5.1.1/gcc_64/lib/libQt5Widgets.so.5
    #1 0x00007ffff5abb859 in QWidget::~QWidget() () from /home/chris/Qt5.1.1/5.1.1/gcc_64/lib/libQt5Widgets.so.5
    #2 0x00007ffff4b8b25a in QObjectPrivate::deleteChildren() () from /home/chris/Qt5.1.1/5.1.1/gcc_64/lib/libQt5Core.so.5
    #3 0x00007ffff5abb5f0 in QWidget::~QWidget() () from /home/chris/Qt5.1.1/5.1.1/gcc_64/lib/libQt5Widgets.so.5
    #4 0x00007ffff5abb859 in QWidget::~QWidget() () from /home/chris/Qt5.1.1/5.1.1/gcc_64/lib/libQt5Widgets.so.5
    #5 0x00007ffff4b8b25a in QObjectPrivate::deleteChildren() () from /home/chris/Qt5.1.1/5.1.1/gcc_64/lib/libQt5Core.so.5
    #6 0x00007ffff5abb5f0 in QWidget::~QWidget() () from /home/chris/Qt5.1.1/5.1.1/gcc_64/lib/libQt5Widgets.so.5
    #7 0x00007ffff5abb859 in QWidget::~QWidget() () from /home/chris/Qt5.1.1/5.1.1/gcc_64/lib/libQt5Widgets.so.5
    #8 0x00007ffff4b8b25a in QObjectPrivate::deleteChildren() () from /home/chris/Qt5.1.1/5.1.1/gcc_64/lib/libQt5Core.so.5
    #9 0x00007ffff5abb5f0 in QWidget::~QWidget() () from /home/chris/Qt5.1.1/5.1.1/gcc_64/lib/libQt5Widgets.so.5
    #10 0x00000000005d9cf1 in mudlet::~mudlet (this=0xdadb30, __in_chrg=<optimized out>) at mudlet.cpp:2294
    #11 0x00000000005d9e96 in mudlet::~mudlet (this=0xdadb30, __in_chrg=<optimized out>) at mudlet.cpp:2296
    #12 0x00007ffff4b8b880 in QObject::event(QEvent*) () from /home/chris/Qt5.1.1/5.1.1/gcc_64/lib/libQt5Core.so.5
    #13 0x00007ffff5ab64f2 in QWidget::event(QEvent*) () from /home/chris/Qt5.1.1/5.1.1/gcc_64/lib/libQt5Widgets.so.5
    #14 0x00007ffff5bd386b in QMainWindow::event(QEvent*) () from /home/chris/Qt5.1.1/5.1.1/gcc_64/lib/libQt5Widgets.so.5
    #15 0x00007ffff5a7fb54 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /home/chris/Qt5.1.1/5.1.1/gcc_64/lib/libQt5Widgets.so.5
    #16 0x00007ffff5a82fe6 in QApplication::notify(QObject*, QEvent*) () from /home/chris/Qt5.1.1/5.1.1/gcc_64/lib/libQt5Widgets.so.5
    #17 0x00007ffff4b62dd4 in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /home/chris/Qt5.1.1/5.1.1/gcc_64/lib/libQt5Core.so.5
    #18 0x00007ffff4b65689 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /home/chris/Qt5.1.1/5.1.1/gcc_64/lib/libQt5Core.so.5
    #19 0x00007ffff6c84141 in QQuickWindow::~QQuickWindow() () from /home/chris/Qt5.1.1/5.1.1/gcc_64/lib/libQt5Quick.so.5
    #20 0x00007ffff6d263a9 in QQuickView::~QQuickView() () from /home/chris/Qt5.1.1/5.1.1/gcc_64/lib/libQt5Quick.so.5

    Any advice on what may be causing this? I'm guessing it's something that is being deleted twice.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.