[Interest] Only 9 QML components can be created partially?
Jonathan Greig
redteam316 at gmail.com
Sat Nov 4 04:37:08 CET 2017
Jonathan P. Greig
aka redteam316
RIP 6/13/1984 - 2/7/2016
On Sun, Oct 1, 2017 at 4:16 AM, Richard Weickelt <richard at weickelt.de>
wrote:
> Hi,
>
> the following example fails after 9 loop iterations:
>
> #include <QtCore>
> #include <QtQml>
>
> int main(int argc, char *argv[])
> {
> QCoreApplication app(argc, argv);
> QQmlEngine engine;
> QQmlComponent* components[47];
> QObject* objects[47];
>
> for (int i = 0; i <= 47; i++)
> {
> components[i] = new QQmlComponent(&engine);
> components[i]->setData("import QtQml 2.0\n QtObject{}", QUrl());
> objects[i] = components[i]->beginCreate(engine.rootContext());
> Q_ASSERT(objects[i] != NULL);
> }
> }
>
> Command line:
> $ test
> QQmlComponent: Component creation is recursing - aborting
> ASSERT: "objects[i] != NULL" in file /XXX/testmain.cpp, line 16
>
> I do not see, how this relates to recursion. The root cause seems to be
> http://code.qt.io/cgit/qt/qtdeclarative.git/commit/?id=
> 19c0a31319148d4ac716f7cb3295891b5a3b20d9
>
> In fact, this patch does not detect recursive component creation. But it
> triggers when more than 9 components are partially created, no matter in
> what structure/order.
>
> Q1: Is the implementation in QQmlComponent wrong?
> Q2: Is my use case a valid one?
>
> Background: I need to create a couple of QML components, but I cannot
> complete creation until all components are partially loaded. Each component
> has a (constant) property that needs to be evaluated first. Depending on
> that, some properties will be injected in the other components.
>
> Q3: Can I achieve that in a different (but simple) way?
>
> Thanks
> Richard
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20171103/35650915/attachment.html>
More information about the Interest
mailing list