Fix diffing cloned rsx nodes by deep cloning nodes before mounting them (#3271)

* Fix diffing cloned rsx nodes by deep cloning nodes before mounting them

* fix clippy
This commit is contained in:
Evan Almloff authored and GitHub committed 2024-12-02 11:35:01 -08:00
1 parent 2c1215c6a4
commit 354c4ce9cc
5 files changed
+99 -4

No files matched your search

+10 -2
View File
@@ -425,8 +425,8 @@ impl<Args, Ret> Clone for Callback<Args, Ret> {
}
impl<Args: 'static, Ret: 'static> PartialEq for Callback<Args, Ret> {
fn eq(&self, _: &Self) -> bool {
true
fn eq(&self, other: &Self) -> bool {
self.callback.ptr_eq(&other.callback) && self.origin == other.origin
}
}
@@ -471,6 +471,14 @@ impl<Args: 'static, Ret: 'static> Callback<Args, Ret> {
Self { callback, origin }
}
/// Leak a new reference to the [`Callback`] that will not be dropped unless the callback is dropped manually
pub(crate) fn leak_reference(&self) -> generational_box::BorrowResult<Callback<Args, Ret>> {
Ok(Callback {
callback: self.callback.leak_reference()?,
origin: self.origin,
})
}
/// Call this callback with the appropriate argument type
///
/// This borrows the callback using a RefCell. Recursively calling a callback will cause a panic.