Skip to content

Make ArcWithoutWeak and Binding sound

Yorick Peterse requested to merge refactor-arc-deref-mut into master

ArcWithoutWeak implemented DerefMut, which allows for multiple mutable references without any form of locking. This was used when modifying the data of a Binding, such as changing its receiver.

In this commit we refactor Binding and ExecutionContext. Binding now relies on interior mutability, and both receiver and parent are made immutable. In turn we refactor both ExecutionContext and the block instruction handlers to match these new changes.

The result is that we can use a regular Rc for a Binding, and don't need to resort to using RefCell and similar types. This also allows us to remove the DerefMut implementation for ArcWithoutWeak, making ArcWithoutWeak sound again.

Thanks to /u/coolreader18 on Reddit 1 for reminding me that ArcWithoutWeak was unsound.

Merge request reports