Hello,

the attached example will run fine when started standalone, but will fail with an assertion

ASSERT: "QThread::currentThread() == QCoreApplication::instance()->thread()" in file /home/ulf/dev/qt5-src/qtdeclarative/src/qml/debugger/qqmldebugserver.cpp, line 551 </home/ulf/dev/qt5-src/qtdeclarative/src/qml/debugger/qqmldebugserver.cpp,%20line%20551>


when trying to debug or profile it. Is that a feature or a bug? I'm asking because I'm wondering when to initialize the QML profiler in the case of multiple QML engines running in parallel. If this assertion didn't exist, when profiling or debugging the example we'd run into various problems with the code in QQmlEnginePrivate::init(). QQmlEnginePrivate::init() only initializes the various debuggers and profilers if it's running in QCoreApplication::instance()->thread().


The test failures I got with https://codereview.qt-project.org/#change,75738 show that a whole profiling session can be started and finished before the QML engine is initialized. Thus I suspect you can even somehow get around that assertion above and crash with a segfault from some debugger or profiler by delaying the start of the main QML engine and starting another one in parallel in the mean time.


I think we should either properly support this case by initializing the debuggers and profilers no matter from which thread (which requires them all to be thread-safe), or we should handle that more gracefully and not just throw an assertion.


regards,

--
Ulf Hermann, Software Engineer - Digia, Qt
Digia Germany GmbH, Rudower Chaussee 13, D-12489 Berlin
Geschäftsführer: Mika Pälsi, Juha Varelius, Tuula Haataja
Registergericht: Amtsgericht Charlottenburg, HRB 144331 B,

Digia Germany is a group company of Digia Plc,
Valimotie 21, FI-00380 Helsinki Finland

Attachment: threadedprofiling.tar.gz
Description: GNU Zip compressed data

_______________________________________________
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to