[Interest] Some crash when adding and removing entities in Qt3D.

Kamil Zaripov kamil at zaripov.net
Tue Mar 7 16:00:28 CET 2017


Hi,

I have entities that should be created and deleted at runtime. Entity have only material and mesh component. Material is QDiffuseMapMaterial with QTextureImage.

When entities begin to add and delete from scene, sometimes application crashes with this assert:

qt_assert: ASSERT: "img != nullptr" in file ../../include/Qt3DRender/5.8.0/Qt3DRender/private/../../../../../src/render/texture/apitexturemanager_p.h, line 286 <x-msg://4/src/render/texture/apitexturemanager_p.h,%20line%20286>

But unfortunately I can’t find why it happenes. I’m adding the entity this way:


    QEntity * visibleObject = new QEntity();

    QDiffuseMapMaterial * material = new QDiffuseMapMaterial();

    QTextureImage * diffuseTextureImage = new QTextureImage();
    diffuseTextureImage->setSource(QUrl("qrc:/resources/tile.png"));
    material->diffuse()->addTextureImage(diffuseTextureImage);
    material->setShininess(0.1);
    visibleObject->addComponent(material);

    // set mesh
    QPlaneMesh * mesh = new QPlaneMesh();
    mesh->setWidth(1.0 / 2);
    mesh->setHeight(1.0 / 2);
    visibleObject->addComponent(mesh);

    visibleObject->setParent(_rootEntity);



 And delete just like this:

    delete visibleObject;



_rootEntity is root entity defined in cpp code. Scene defined in QML file using Scene3D:

     Scene3D {
         id: scene
         anchors.fill: parent
         aspects: ["render", "logic", "input"]

         entity: rootEntity
     }

And _rootEntity passed like this:

context->setContextProperty("rootEntity", _rootEntity);

If it is necessary I can prepare simple example that reproduce issue.

Thanks.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20170307/0d498cec/attachment.html>


More information about the Interest mailing list