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

[6.10 REG] ASSERT failure in QQuickWindow: "Called object is not of the correct type (class destructor may have already run)"

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P1: Critical P1: Critical
    • 6.10.0
    • 6.10.0 Beta4
    • Quick: Other
    • None
    • All
    • a346f6d0f (dev)

      #include <QGuiApplication>
      #include <QQuickWindow>
      #include <QTimer>
      
      int main(int argc, char *argv[])
      {
          QGuiApplication app(argc, argv);
      
          QQuickWindow view1;
          auto view2 = new QQuickWindow(&view1);
      
          view1.show();
          view2->show();
      
          QTimer::singleShot(1000, &app, &QGuiApplication::quit);
      
          return app.exec();
      } 

      With the offscreen QPA, the above snippet will crash once view1 is deleted.

      Make sure you test with asserts enabled (debug Qt build for example) and pass -platform offscreen

      (gdb) bt
      
      #0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
      
      #1  0x00007ffff3a98a13 in __pthread_kill_internal (threadid=<optimized out>, signo=6) at pthread_kill.c:89
      
      #2  0x00007ffff3a3e410 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
      
      #3  0x00007ffff3a2557a in __GI_abort () at abort.c:77
      
      #4  0x00007ffff42c75de in qAbort () at /pub_data/sources/qt/qt6/qtbase/src/corelib/global/qassert.cpp:46
      
      #5  0x00007ffff435c929 in qt_maybe_message_fatal<QString&> (msgType=<optimized out>, context=..., message=...) at /pub_data/sources/qt/qt6/qtbase/src/corelib/global/qlogging.cpp:2168
      
      #6  qt_message(QtMsgType, const QMessageLogContext &, const char *, typedef __va_list_tag __va_list_tag *) (msgType=msgType@entry=QtFatalMsg, context=..., msg=msg@entry=0x7ffff4795f18 "ASSERT failure in %s: \"%s\", file %s, line %d", ap=ap@entry=0x7fffffffc228)
      
          at /pub_data/sources/qt/qt6/qtbase/src/corelib/global/qlogging.cpp:412
      
      #7  0x00007ffff42c98fb in QMessageLogger::fatal (this=this@entry=0x7fffffffc460, msg=msg@entry=0x7ffff4795f18 "ASSERT failure in %s: \"%s\", file %s, line %d") at /pub_data/sources/qt/qt6/qtbase/src/corelib/global/qlogging.cpp:901
      
      #8  0x00007ffff42c769f in qt_assert_x (where=<optimized out>, what=what@entry=0x7ffff6ed3c30 "Called object is not of the correct type (class destructor may have already run)", file=file@entry=0x7ffff6ed3be8 "/pub_data/sources/qt/qt6/qtbase/src/corelib/kernel/qobjectdefs_impl.h", line=line@entry=105)
      
          at /pub_data/sources/qt/qt6/qtbase/src/corelib/global/qassert.cpp:119
      
      #9  0x00007ffff6b2cf64 in QtPrivate::assertObjectType<QQuickWindow> (o=<optimized out>) at /pub_data/sources/qt/qt6/qtbase/src/corelib/kernel/qobjectdefs_impl.h:94
      
      #10 QtPrivate::assertObjectType<QQuickWindow> (o=<optimized out>) at /pub_data/sources/qt/qt6/qtbase/src/corelib/kernel/qobjectdefs_impl.h:94
      
      #11 QtPrivate::FunctorCall<std::integer_sequence<unsigned long>, QtPrivate::List<>, void, void (QQuickWindow::*)()>::call(void (QQuickWindow::*)(), QQuickWindow*, void**) (f=<optimized out>, o=<optimized out>, arg=<optimized out>) at /pub_data/sources/qt/qt6/qtbase/src/corelib/kernel/qobjectdefs_impl.h:125
      
      #12 QtPrivate::FunctionPointer<void (QQuickWindow::*)()>::call<QtPrivate::List<>, void>(void (QQuickWindow::*)(), QQuickWindow*, void**) (f=<optimized out>, o=<optimized out>, arg=<optimized out>) at /pub_data/sources/qt/qt6/qtbase/src/corelib/kernel/qobjectdefs_impl.h:174
      
      #13 QtPrivate::QCallableObject<void (QQuickWindow::*)(), QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (which=<optimized out>, this_=<optimized out>, r=<optimized out>, a=<optimized out>, ret=<optimized out>)
      
          at /pub_data/sources/qt/qt6/qtbase/src/corelib/kernel/qobjectdefs_impl.h:545
      
      #14 0x00007ffff4468ee5 in QtPrivate::QSlotObjectBase::call (this=0x55555564ae20, r=<optimized out>, a=0x7fffffffc540) at /pub_data/sources/qt/qt6/qtbase/src/corelib/kernel/qobjectdefs_impl.h:461
      
      #15 doActivate<false> (sender=0x55555564e400, signal_index=4, argv=0x7fffffffc540) at /pub_data/sources/qt/qt6/qtbase/src/corelib/kernel/qobject.cpp:4314
      
      #16 0x00007ffff6b6af8a in QSGSoftwareRenderLoop::windowDestroyed (this=0x5555556490b0, window=<optimized out>) at /pub_data/sources/qt/qt6/qtdeclarative/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp:70
      
      #17 0x00007ffff6b37e0c in QQuickWindow::~QQuickWindow (this=0x55555564b330) at /pub_data/sources/qt/qt6/qtdeclarative/src/quick/items/qquickwindow.cpp:1185
      
      #18 0x00007ffff6b37e62 in QQuickWindow::~QQuickWindow (this=0x55555564b330) at /pub_data/sources/qt/qt6/qtdeclarative/src/quick/items/qquickwindow.cpp:1216
      
      #19 0x00007ffff5ed8255 in qDeleteAll<QList<QWindow*>::const_iterator> (begin=..., end=...) at /pub_data/sources/qt/qt6/qtbase/src/corelib/tools/qalgorithms.h:24
      
      #20 qDeleteAll<QList<QWindow*> > (c=...) at /pub_data/sources/qt/qt6/qtbase/src/corelib/tools/qalgorithms.h:32
      
      #21 QWindow::~QWindow (this=this@entry=0x7fffffffc710) at /pub_data/sources/qt/qt6/qtbase/src/gui/kernel/qwindow.cpp:197
      
      #22 0x00007ffff6b37be2 in QQuickWindow::~QQuickWindow (this=this@entry=0x7fffffffc710) at /pub_data/sources/qt/qt6/qtdeclarative/src/quick/items/qquickwindow.cpp:1216
      
      #23 0x00005555556133f3 in main (argc=<optimized out>, argv=<optimized out>) at main.cpp:19
       

      Note that the offscreen QPA is very important to run tests in CI and has been working with all previous Qt versions

        For Gerrit Dashboard: QTBUG-140170
        # Subject Branch Project Status CR V

            dfaure_kdab David Faure
            sergio.luis Sergio Martins
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:

                There is 1 open Gerrit change