Fix cloned rsx double drop (#2839)
* Implement Rc generational pointers * Clean up error handling a bit * start adding tests * Simplify a few types * Separate Rc and normal generational boxes * Add tests for rc drop and read * Move over the pointer instead of the data in ReadOnlySignal props * Fix panic on ref drop and release mode builds * final rc signal cleanup * use rc generational boxes for event handlers as well * add a regression test for read only signal cloning * merge main --------- Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
This commit is contained in:
1 parent
20d146d9bd
commit
baf5a95cae
19 files changed
+905
-250
No files matched your search
@@ -42,25 +42,17 @@ impl<T: 'static, S: Storage<SignalData<T>>> ReadOnlySignal<T, S> {
|
||||
self.inner.id()
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
/// This should only be used by the `rsx!` macro.
|
||||
pub fn __set(&mut self, value: T) {
|
||||
use crate::write::Writable;
|
||||
use warnings::Warning;
|
||||
// This is only called when converting T -> ReadOnlySignal<T> which will not cause loops
|
||||
crate::warnings::signal_write_in_component_body::allow(|| {
|
||||
crate::warnings::signal_read_and_write_in_reactive_scope::allow(|| {
|
||||
self.inner.set(value);
|
||||
});
|
||||
});
|
||||
/// Point to another signal
|
||||
pub fn point_to(&mut self, other: Self) -> BorrowResult {
|
||||
self.inner.point_to(other.inner)
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
/// This should only be used by the `rsx!` macro.
|
||||
pub fn __take(&self) -> T {
|
||||
self.inner
|
||||
.manually_drop()
|
||||
.expect("Signal has already been dropped")
|
||||
/// This is only used by the `props` macro.
|
||||
/// Mark any readers of the signal as dirty
|
||||
pub fn mark_dirty(&mut self) {
|
||||
use crate::write::Writable;
|
||||
_ = self.inner.try_write();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user