-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure an Rc isn't freed while running its own destructor.
A weak pointer inside itself will have its destructor run when the last strong pointer to that data disappears, so we need to make sure that the Weak and Rc destructors don't duplicate work (i.e. freeing). By making the Rcs effectively take a weak pointer, we ensure that no Weak destructor will free the pointer while still ensuring that Weak pointers can't be upgraded to strong ones as the destructors run. This approach of starting weak at 1 is what libstdc++ does. Fixes #12046.
- Loading branch information
Showing
1 changed file
with
27 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
da45340
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.
saw approval from thestinger
at huonw@da45340
da45340
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.
merging huonw/rust/cyclic-rc = da45340 into auto
da45340
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.
huonw/rust/cyclic-rc = da45340 merged ok, testing candidate = 9a9a70b
da45340
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.
all tests pass:
success: http://buildbot.rust-lang.org/builders/auto-mac-32-opt/builds/4051
success: http://buildbot.rust-lang.org/builders/auto-mac-32-nopt-c/builds/1893
success: http://buildbot.rust-lang.org/builders/auto-mac-32-nopt-t/builds/1895
success: http://buildbot.rust-lang.org/builders/auto-mac-64-opt/builds/4051
success: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-c/builds/3151
success: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-t/builds/3157
success: http://buildbot.rust-lang.org/builders/auto-linux-32-opt/builds/4066
success: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-c/builds/3154
success: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-t/builds/3160
success: http://buildbot.rust-lang.org/builders/auto-linux-64-opt/builds/4068
success: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-c/builds/3154
success: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-t/builds/3159
success: http://buildbot.rust-lang.org/builders/auto-linux-64-x-android/builds/3228
success: http://buildbot.rust-lang.org/builders/auto-linux-64-x-android-t/builds/1006
success: http://buildbot.rust-lang.org/builders/auto-win-32-opt/builds/4059
success: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-c/builds/3160
success: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-t/builds/3165
success: http://buildbot.rust-lang.org/builders/auto-bsd-64-opt/builds/3828
da45340
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.
fast-forwarding master to auto = 9a9a70b