File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -2391,6 +2391,9 @@ impl dispatch::DeviceInterface for WebDevice {
2391
2391
) ;
2392
2392
} ) ;
2393
2393
let _ = self . inner . lost ( ) . then ( & closure) ;
2394
+ // Release memory management of this closure from Rust to the JS GC.
2395
+ // TODO: This will leak if weak references is not supported.
2396
+ closure. forget ( ) ;
2394
2397
}
2395
2398
2396
2399
fn on_uncaptured_error ( & self , handler : Box < dyn crate :: UncapturedErrorHandler > ) {
@@ -2400,7 +2403,8 @@ impl dispatch::DeviceInterface for WebDevice {
2400
2403
} ) as Box < dyn FnMut ( _) > ) ;
2401
2404
self . inner
2402
2405
. set_onuncapturederror ( Some ( f. as_ref ( ) . unchecked_ref ( ) ) ) ;
2403
- // TODO: This will leak the memory associated with the error handler by default.
2406
+ // Release memory management of this closure from Rust to the JS GC.
2407
+ // TODO: This will leak if weak references is not supported.
2404
2408
f. forget ( ) ;
2405
2409
}
2406
2410
You can’t perform that action at this time.
0 commit comments