Reclaim objects left behind by an interrupted pointer load - #365
Open
gennaroprota wants to merge 1 commit into
Open
Reclaim objects left behind by an interrupted pointer load#365gennaroprota wants to merge 1 commit into
gennaroprota wants to merge 1 commit into
Conversation
`delete_created_pointers()` only freed objects whose load had run to completion, so a load cut short by an exception leaked the object it had already created. It also freed objects an owning smart pointer had taken over, double freeing the elements of a `vector<shared_ptr>` whether the load failed part way or succeeded outright. An object becomes reclaimable once its constructor has run, and only when no enclosing created object owns it: freeing that one runs the destructors of the objects below it rather than freeing them twice. An adopting `shared_ptr`, `unique_ptr` or `scoped_ptr` takes the object over and the archive then leaves it alone. Fixes #260.
gennaroprota
force-pushed
the
fix/reclaim-pointer-when-load-interrupted
branch
from
August 6, 2026 10:05
e43401c to
5a4adc3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
delete_created_pointers()only freed objects whose load had run to completion, so a load cut short by an exception leaked the object it had already created. It also freed objects an owning smart pointer had taken over, double freeing the elements of avector<shared_ptr>whether the load failed part way or succeeded outright.An object becomes reclaimable once its constructor has run, and only when no enclosing created object owns it: freeing that one runs the destructors of the objects below it rather than freeing them twice. An adopting
shared_ptr,unique_ptrorscoped_ptrtakes the object over and the archive then leaves it alone.Fixes #260.