Skip to content

Conversation

@qgis-bot
Copy link
Collaborator

@qgis-bot qgis-bot commented Jan 5, 2026

Backport #64269
Authored by: @ptitjano

When a marker parameter is changed (for example enabling or disabling
the markers, changing the color or the width), the
`updateMarkerMaterial` material is called. This function always
creates a new `QgsPoint3DBillboardMaterial` even if a material already
exists. This entity ends up with multiple materials when it should
only have one.

This issue is fixed by checking if `mMarkerMaterial` already
exists. If that's the case, the existing material is updated instead
of creating a new one.

If the markers are disabled, the material is removed from the entity
as already done. Now, it also deleted and set to null to ensure its
recreation if needed later on.
This ensures to avoid crashes if the entity is quickly deleted or
updated.

Indeed, Qt3D needs to keep both a frontend a backend in order to
optimize the scene graph interactions. This can result in some
entities being created and deleted in the frontend before the backend
is able to handle those entities.

Besides the parent logic is a mix of the Qt parent logic of any
QObject and the parent/child logic of the scene graph.

A simple rule to prevent any crashes is the following:
 - use a parent for entities in the constructor
 - do not use parents for components. An entity takes reponsability of
 of a component once added to the entity with the `addComponent` call.

This rule is applied to the |mLineEntity` entity. This should help
resolve segfaults that sometimes happen when using a rubberband.
@github-actions
Copy link
Contributor

github-actions bot commented Jan 5, 2026

🪟 Windows builds

Download Windows builds of this PR for testing.
Debug symbols for this build are available here.
(Built from commit ffe8927)

🪟 Windows Qt6 builds

Download Windows Qt6 builds of this PR for testing.
(Built from commit ffe8927)

@github-actions github-actions bot added this to the 3.44.7 milestone Jan 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants