[vector] Destruct items in clear() when vector is in error state

The previous fix (d134f888) zeroed `length` but skipped element
destructors. Call shrink_vector(0) instead, which properly destructs
items before clearing length.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Behdad EsfahbodandClaude Opus 4.6 committed 2026-03-26 14:19:41 -06:00
1 parent 7433361337
commit 41de3c3272
1 file changed
+1 -1
+1 -1
View File
@@ -578,7 +578,7 @@ struct hb_vector_t
void clear ()
{
if (!resize (0))
length = 0; /* If resize fails (e.g. vector in error state), still clear length. */
shrink_vector (0); /* If resize fails (e.g. vector in error state), still destruct items and clear length. */
}
template <typename allocator_t>