-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(memory): prevent double destruction in AnyVector::swapMove #1358
Conversation
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1358 +/- ##
=======================================
Coverage 41.95% 41.95%
=======================================
Files 441 441
Lines 33115 33115
Branches 3870 3870
=======================================
Hits 13893 13893
Misses 19222 19222 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems simple enough! If only all bugs were solved with a line change...
Although one thing I notice now is why do we have assertions in the middle of srccode? Shouldn't we have tests with those instead? |
They're just sanity checks, it's good practice to write all assumptions of the code in assertions 😌 |
c2a7f10
to
719de61
Compare
This happened only when the last element of an AnyVector was removed in a swapMove. The destructor of the last element was called in the swapMove itself, and once again on pop.
719de61
to
05583bc
Compare
Description
This happened only when the last element of an AnyVector was removed in a swapMove.
The destructor of the last element was called in the swapMove itself, and once again on pop.
So, simply moved the extra destructor call to within the if itself.
Checklist