about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorHuon Wilson <dbau.pp+github@gmail.com>2014-02-05 21:41:26 +1100
committerHuon Wilson <dbau.pp+github@gmail.com>2014-02-06 09:05:59 +1100
commitda45340ab84603cf6932b012b977bc2e7b8d6764 (patch)
tree34117a5a995ad4e4938e465436d843998aeeef37 /src/rustllvm/RustWrapper.cpp
parent53864ce5121b1b36679dfb901f85a98172cde19b (diff)
downloadrust-da45340ab84603cf6932b012b977bc2e7b8d6764.tar.gz
rust-da45340ab84603cf6932b012b977bc2e7b8d6764.zip
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.
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions