Sfoglia il codice sorgente

fix: add lock to asset handler handle request on android (#4006)

Rhaskia 2 mesi fa
parent
commit
1ac57f1a36
1 ha cambiato i file con 4 aggiunte e 0 eliminazioni
  1. 4 0
      packages/desktop/src/assets.rs

+ 4 - 0
packages/desktop/src/assets.rs

@@ -33,6 +33,10 @@ impl AssetHandlerRegistry {
         responder: RequestAsyncResponder,
     ) {
         if let Some(handler) = self.handlers.borrow().get(name) {
+            // Avoid handler being already borrowed on android
+            #[cfg(target_os = "android")]
+            let _lock = crate::android_sync_lock::android_runtime_lock();
+
             // And run the handler in the scope of the component that created it
             handler.f.call((request, responder));
         }