Skip to content

Commit

Permalink
fix: [android] possible deadlock when reading from clipboard (#282)
Browse files Browse the repository at this point in the history
  • Loading branch information
knopp authored Jan 1, 2024
1 parent ad03b82 commit f0ef4e5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions super_native_extensions/rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ pub extern "C" fn super_native_extensions_init() {
#[cfg(target_os = "android")]
mod android {

use irondash_run_loop::RunLoop;
use once_cell::sync::OnceCell;

use crate::init;
Expand All @@ -151,6 +152,12 @@ mod android {
use ::log::Level;
use android_logger::Config;

// This is to ensure that engine context is not used for sending things
// to main thread. EngineContext main thread sender does not work properly
// with RunLoop::poll_once, which is used during clipboard access.
// Without this clipboard access may deadlock.
RunLoop::set_main_thread();

android_logger::init_once(
Config::default()
.with_min_level(Level::Info)
Expand Down

0 comments on commit f0ef4e5

Please sign in to comment.