Hi, I was randomly browsing your repo and the line
GLOBAL_CALLBACK = Some(Box::new(callback));
struck me. There's no synchronization when modifying this static mut and it's code directly reachable from client code, making it thread unsafe.
I'd recommend to add a mutex or mark that function unsafe. If you plan to keep it safe, I'd also recommend making sure the raw_callback is aware of callback change too. Checking if this idiom isn't used incorrectly elsewhere might help too.
Hi, I was randomly browsing your repo and the line
struck me. There's no synchronization when modifying this static mut and it's code directly reachable from client code, making it thread unsafe.
I'd recommend to add a mutex or mark that function unsafe. If you plan to keep it safe, I'd also recommend making sure the
raw_callback
is aware of callback change too. Checking if this idiom isn't used incorrectly elsewhere might help too.