Skip to content

Break the shared_ptr cycle between PavingNode parents and children - #484

Merged
SimonRohou merged 1 commit into
codac-team:codac2_devfrom
Jordan08:dev-clean-v2-12
Oct 9, 2026
Merged

SimonRohou merged 1 commit into
codac-team:codac2_devfrom
Jordan08:dev-clean-v2-12

Conversation

@Jordan08

Copy link
Copy Markdown
Contributor

AddressSanitizer (LeakSanitizer) signalait des fuites dans les pavages : un PavingNode possède ses fils (_left, _right) et gardait aussi son parent par shared_ptr, si bien que chaque parent et ses fils se possédaient mutuellement ; une fois le Paving détruit, aucun nœud d'un arbre bissecté n'était libéré. Le parent est maintenant tenu par un weak_ptr.
L'arbre est aussi construit par les constructeurs de PavingOut et PavingInOut (init_tree()) plutôt que par celui de Paving, où *static_cast<P*>(this) désignait un P pas encore construit. Des commentaires l'expliquent dans le code, et un test de non-régression est ajouté dans codac2_tests_CtcInverse.cpp.

PR 12/64 de la série dev-clean-v2 (ordre et dépendances : #471). Indépendante : basée directement sur codac2, elle peut être mergée à tout moment.

@SimonRohou
SimonRohou changed the base branch from codac2 to codac2_dev October 9, 2026 15:40
@SimonRohou
SimonRohou merged commit 36a140f into codac-team:codac2_dev Oct 9, 2026
80 checks passed
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.

2 participants