Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.13.1
-
None
Description
I have created a page using StackView, and I transit to a page that contains a Scene3D with a basic qt3d scene. This scene must put a dynamic texture on a quad, so I used Scene2D for rendering a Image component and then applying the result texture to a quad.
However, when I transit back to another page, leaving the Scene3D page (and technically destryoing it), sometimes the main thread gets blocked. After gdb'ing I found out that its about the destruction of Scene2D element.
I have tried to create the Scene2D in many different ways (EntityLoader, NodeInstantiator, change the parent Entity), but nothing helps.
The problem happens sporadically. I think it has someting to do with threads synchronization...
1) Above is the stack trace of the main thread:
[Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". 0x00007f35b50fb15f in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0 (gdb) bt #0 0x00007f35b50fb15f in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0 #1 0x00007f35b564c6a3 in QWaitConditionPrivate::wait (deadline=..., this=0x55ff6b6f0df0) at /sources/qt-everywhere-src-5.13.1/qtbase/src/corelib/thread/qwaitcondition_unix.cpp:146 #2 QWaitCondition::wait (this=<optimized out>, mutex=0x55ff6cbf0588, deadline=...) at /sources/qt-everywhere-src-5.13.1/qtbase/src/corelib/thread/qwaitcondition_unix.cpp:225 #3 0x00007f35b564c9c9 in QWaitCondition::wait (this=0x55ff6cbf0580, mutex=0x55ff6cbf0588, time=time@entry=18446744073709551615) at /sources/qt-everywhere-src-5.13.1/qtbase/src/corelib/thread/qwaitcondition_unix.cpp:208 #4 0x00007f359a9cb4d4 in Qt3DRender::Quick::Scene2DSharedObject::wait (this=<optimized out>) at /sources/qt-everywhere-src-5.13.1/qt3d/src/quick3d/quick3dscene2d/items/scene2dsharedobject.cpp:146 #5 0x00007f359a9cad6d in Qt3DRender::Quick::Scene2DManager::stopAndClean (this=0x55ff6b378270) at /sources/qt-everywhere-src-5.13.1/qt3d/src/quick3d/quick3dscene2d/items/scene2dmanager.cpp:163 #6 0x00007f359a9c5ad5 in Qt3DRender::Quick::QScene2DPrivate::~QScene2DPrivate (this=0x55ff6b384ab0, __in_chrg=<optimized out>) at /sources/qt-everywhere-src-5.13.1/qt3d/src/quick3d/quick3dscene2d/items/qscene2d.cpp:189 #7 0x00007f359a9c5b59 in Qt3DRender::Quick::QScene2DPrivate::~QScene2DPrivate (this=0x55ff6b384ab0, __in_chrg=<optimized out>) at /sources/qt-everywhere-src-5.13.1/qt3d/src/quick3d/quick3dscene2d/items/qscene2d.cpp:191 #8 0x00007f35b5847bd7 in QScopedPointerDeleter<QObjectData>::cleanup (pointer=<optimized out>) at /sources/qt-everywhere-src-5.13.1/qtbase/include/QtCore/../../src/corelib/tools/qscopedpointer.h:60 #9 QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> >::~QScopedPointer (this=0x55ff6b396cc8, __in_chrg=<optimized out>) at /sources/qt-everywhere-src-5.13.1/qtbase/include/QtCore/../../src/corelib/tools/qscopedpointer.h:107 #10 QObject::~QObject (this=<optimized out>, __in_chrg=<optimized out>) at /sources/qt-everywhere-src-5.13.1/qtbase/src/corelib/kernel/qobject.cpp:891 #11 0x00007f359abd3309 in Qt3DRender::Quick::QScene2D::~QScene2D (this=0x55ff6b396cc0, __in_chrg=<optimized out>) at /sources/qt-everywhere-src-5.13.1/qt3d/include/Qt3DQuickScene2D/../../src/quick3d/quick3dscene2d/items/qscene2d.h:63 #12 QQmlPrivate::QQmlElement<Qt3DRender::Quick::QScene2D>::~QQmlElement (this=0x55ff6b396cc0, __in_chrg=<optimized out>) at /sources/qt-everywhere-src-5.13.1/qtdeclarative/include/QtQml/../../src/qml/qml/qqmlprivate.h:108 #13 QQmlPrivate::QQmlElement<Qt3DRender::Quick::QScene2D>::~QQmlElement (this=0x55ff6b396cc0, __in_chrg=<optimized out>) at /sources/qt-everywhere-src-5.13.1/qtdeclarative/include/QtQml/../../src/qml/qml/qqmlprivate.h:108 #14 0x00007f35b583d8c1 in QObjectPrivate::deleteChildren (this=this@entry=0x55ff6b580200) at /sources/qt-everywhere-src-5.13.1/qtbase/src/corelib/kernel/qobject.cpp:2019 #15 0x00007f35b5847b8f in QObject::~QObject (this=<optimized out>, __in_chrg=<optimized out>) at /sources/qt-everywhere-src-5.13.1/qtbase/src/corelib/kernel/qobject.cpp:1032 #16 0x00007f35a0c8a2bb in QQmlPrivate::QQmlElement<Qt3DCore::QEntity>::~QQmlElement (this=0x55ff6b571770, __in_chrg=<optimized out>) at /sources/qt-everywhere-src-5.13.1/qtdeclarative/include/QtQml/../../src/qml/qml/qqmlprivate.h:108 #17 QQmlPrivate::QQmlElement<Qt3DCore::QEntity>::~QQmlElement (this=0x55ff6b571770, __in_chrg=<optimized out>) at /sources/qt-everywhere-src-5.13.1/qtdeclarative/include/QtQml/../../src/qml/qml/qqmlprivate.h:108 #18 0x00007f35b583d8c1 in QObjectPrivate::deleteChildren (this=this@entry=0x55ff6b70eab0) at /sources/qt-everywhere-src-5.13.1/qtbase/src/corelib/kernel/qobject.cpp:2019 #19 0x00007f35b5847b8f in QObject::~QObject (this=<optimized out>, __in_chrg=<optimized out>) at /sources/qt-everywhere-src-5.13.1/qtbase/src/corelib/kernel/qobject.cpp:1032 #20 0x00007f35a0c8a2bb in QQmlPrivate::QQmlElement<Qt3DCore::QEntity>::~QQmlElement (this=0x55ff6c37a450, __in_chrg=<optimized out>) at /sources/qt-everywhere-src-5.13.1/qtdeclarative/include/QtQml/../../src/qml/qml/qqmlprivate.h:108 #21 QQmlPrivate::QQmlElement<Qt3DCore::QEntity>::~QQmlElement (this=0x55ff6c37a450, __in_chrg=<optimized out>) at /sources/qt-everywhere-src-5.13.1/qtdeclarative/include/QtQml/../../src/qml/qml/qqmlprivate.h:108 #22 0x00007f35a081b9a6 in QtSharedPointer::ExternalRefCountData::destroy (this=0x55ff6e001130) at /sources/qt-everywhere-src-5.13.1/qtbase/include/QtCore/../../src/corelib/tools/qsharedpointer_impl.h:157 #23 QSharedPointer<Qt3DCore::QEntity>::deref (dd=0x55ff6e001130) at /sources/qt-everywhere-src-5.13.1/qtbase/include/QtCore/../../src/corelib/tools/qsharedpointer_impl.h:465 #24 QSharedPointer<Qt3DCore::QEntity>::deref (this=<synthetic pointer>) at /sources/qt-everywhere-src-5.13.1/qtbase/include/QtCore/../../src/corelib/tools/qsharedpointer_impl.h:460 #25 QSharedPointer<Qt3DCore::QEntity>::~QSharedPointer (this=<synthetic pointer>, __in_chrg=<optimized out>) at /sources/qt-everywhere-src-5.13.1/qtbase/include/QtCore/../../src/corelib/tools/qsharedpointer_impl.h:315 #26 QSharedPointer<Qt3DCore::QEntity>::operator= (other=..., this=0x55ff6b367c58) at /sources/qt-everywhere-src-5.13.1/qtbase/include/QtCore/../../src/corelib/tools/qsharedpointer_impl.h:334 #27 Qt3DCore::QAspectEngine::setRootEntity (this=this@entry=0x55ff6e609980, root=...) at /sources/qt-everywhere-src-5.13.1/qt3d/src/core/aspects/qaspectengine.cpp:426 #28 0x00007f35a081bc5a in Qt3DCore::QAspectEngine::~QAspectEngine (this=0x55ff6e609980, __in_chrg=<optimized out>) at /sources/qt-everywhere-src-5.13.1/qt3d/src/core/aspects/qaspectengine.cpp:202 #29 0x00007f35a081be59 in Qt3DCore::QAspectEngine::~QAspectEngine (this=0x55ff6e609980, __in_chrg=<optimized out>) at /sources/qt-everywhere-src-5.13.1/qt3d/src/core/aspects/qaspectengine.cpp:216 #30 0x00007f359a7b3cd7 in Qt3DRender::Scene3DCleaner::cleanup (this=0x55ff6b58ca50) at /sources/qt-everywhere-src-5.13.1/qt3d/src/quick3d/imports/scene3d/scene3dcleaner.cpp:66 #31 0x00007f35b5840bc1 in QObject::event (this=0x55ff6b58ca50, e=<optimized out>) at /sources/qt-everywhere-src-5.13.1/qtbase/src/corelib/kernel/qobject.cpp:1260 #32 0x00007f35b5811ef8 in QCoreApplication::notifyInternal2 (receiver=0x55ff6b58ca50, event=0x7f3576e2c880) at /sources/qt-everywhere-src-5.13.1/qtbase/src/corelib/kernel/qcoreapplication.cpp:1095 #33 0x00007f35b581209e in QCoreApplication::sendEvent (receiver=<optimized out>, event=event@entry=0x7f3576e2c880) at /sources/qt-everywhere-src-5.13.1/qtbase/src/corelib/kernel/qcoreapplication.cpp:1490 #34 0x00007f35b58154fe in QCoreApplicationPrivate::sendPostedEvents (receiver=receiver@entry=0x0, event_type=event_type@entry=0, data=0x55ff6b314920) at /sources/qt-everywhere-src-5.13.1/qtbase/src/corelib/kernel/qcoreapplication.cpp:1840 #35 0x00007f35b5815a28 in QCoreApplication::sendPostedEvents (receiver=receiver@entry=0x0, event_type=event_type@entry=0) at /sources/qt-everywhere-src-5.13.1/qtbase/src/corelib/kernel/qcoreapplication.cpp:1694 ---Type <return> to continue, or q <return> to quit--- #36 0x00007f35b586b8b3 in postEventSourceDispatch (s=0x55ff6b31b010) at /sources/qt-everywhere-src-5.13.1/qtbase/src/corelib/kernel/qeventdispatcher_glib.cpp:277 #37 0x00007f35b12dd7f7 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0 #38 0x00007f35b12dda60 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0 #39 0x00007f35b12ddb0c in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0 #40 0x00007f35b586aeff in QEventDispatcherGlib::processEvents (this=0x55ff6b355530, flags=...) at /sources/qt-everywhere-src-5.13.1/qtbase/src/corelib/kernel/qeventdispatcher_glib.cpp:423 #41 0x00007f35b581085a in QEventLoop::exec (this=this@entry=0x7ffe3eb0c340, flags=..., flags@entry=...) at /sources/qt-everywhere-src-5.13.1/qtbase/src/corelib/kernel/qeventloop.cpp:225 #42 0x00007f35b5819360 in QCoreApplication::exec () at /sources/qt-everywhere-src-5.13.1/qtbase/src/corelib/kernel/qcoreapplication.cpp:1403 #43 0x000055ff695a0065 in main (argc=<optimized out>, argv=<optimized out>) at /sources/qt-everywhere-src-5.13.1/qtdeclarative/tools/qml/main.cpp:597
2) It looks like the thread is in dead lock in some mutex..
What also looks strange is this:
#6 0x00007f359a9c5ad5 in Qt3DRender::Quick::QScene2DPrivate::~QScene2DPrivate (this=0x55ff6b384ab0, __in_chrg=<optimized out>)
at /sources/qt-everywhere-src-5.13.1/qt3d/src/quick3d/quick3dscene2d/items/qscene2d.cpp:189
#7 0x00007f359a9c5b59 in Qt3DRender::Quick::QScene2DPrivate::~QScene2DPrivate (this=0x55ff6b384ab0, __in_chrg=<optimized out>)
at /sources/qt-everywhere-src-5.13.1/qt3d/src/quick3d/quick3dscene2d/items/qscene2d.cpp:191
The destructor seems to be called twice for the same instance address.. but Im not sure why stack path shows different line numbers.
3) It sometimes can take a long time to happen. But I figured that for slower machines, it can happen much faster.. Maybe there is something to do with the render speed.. not sure.
In one machine of mine, it happens almost imediatelly. In some other can take time.
4) I have created a very simple example using Scene2D (in which I dont even use the resulting texture, is just for test). Using this example in a slower machine, the problem always happens quickly.
Please check the attachment for the example. In the example, I transit pages in the stackview automatically using a timer, for making the problem happen, but I originally discovered the problem clicking manually to change page (in a button).
Let me know if any other information is needed.
Thanks