commit | 0d3bc4cadce10df5d5295af67455a1dfed5f4bcf | [log] [tgz] |
---|---|---|
author | Taylor Cramer <cramertj@google.com> | Fri Jan 05 19:32:25 2024 +0000 |
committer | CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com> | Fri Jan 05 19:32:25 2024 +0000 |
tree | fd3b9a68bd944dd29853881e0583df8194974976 | |
parent | fe8e3d2b5eda0518a98db2ab346d4e450b530a73 [diff] |
pw_containers: Remove DestructorHelper from vector DestructorHelper was unsound: it would invoke `clear()` upon destruction of the base class after the child class containing the container storage had already been destroyed. This CL instead introduces an intermediate storage class specialized on trivially_destructible which implements the element-wise destruction. Additionally, this CL overrides `delete` privately in order to prevent calling `delete` on a polymorphic-sized container. Previously, calling `delete` in this way would result in undefined behavior due to the fact that the base class destructor was non-virtual. Bug: b/301329862 Change-Id: I319a6ff7ace4ee1b34ba29596d66468d5b0fad6a Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/185521 Reviewed-by: Aaron Green <aarongreen@google.com> Commit-Queue: Taylor Cramer <cramertj@google.com>
Pigweed is an open source collection of embedded-targeted libraries–or as we like to call them, modules. These modules are building blocks and infrastructure that enable faster and more reliable development on small-footprint MMU-less 32-bit microcontrollers like the STMicroelectronics STM32L452 or the Nordic nRF52832.
For more information please see our website: https://pigweed.dev/.