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
@@ -1,6 +1,3 @@
|
||||
use std::cell::RefCell;
|
||||
use std::rc::Rc;
|
||||
|
||||
use dioxus_core::prelude::use_hook;
|
||||
use dioxus_core::prelude::Callback;
|
||||
|
||||
@@ -19,7 +16,7 @@ pub fn use_callback<T: 'static, O: 'static>(f: impl FnMut(T) -> O + 'static) ->
|
||||
|
||||
if let Some(callback) = callback.take() {
|
||||
// Every time this hook is called replace the inner callback with the new callback
|
||||
inner.__set(Rc::new(RefCell::new(callback)));
|
||||
inner.replace(Box::new(callback));
|
||||
}
|
||||
|
||||
inner
|
||||
|
||||
Reference in new issue
Block a user