Callbacks must not be able to unwind into sqlite code

This commit is contained in:
gwenn
2018-12-16 09:40:14 +01:00
parent bdfc2dfc54
commit bd9b850c43
6 changed files with 100 additions and 48 deletions

View File

@@ -4,6 +4,8 @@ use std::os::raw::c_int;
#[cfg(feature = "unlock_notify")]
use std::os::raw::c_void;
#[cfg(feature = "unlock_notify")]
use std::panic::catch_unwind;
#[cfg(feature = "unlock_notify")]
use std::sync::{Condvar, Mutex};
use crate::ffi;
@@ -42,8 +44,10 @@ unsafe extern "C" fn unlock_notify_cb(ap_arg: *mut *mut c_void, n_arg: c_int) {
use std::slice::from_raw_parts;
let args = from_raw_parts(ap_arg, n_arg as usize);
for arg in args {
let un: &mut UnlockNotification = &mut *(*arg as *mut UnlockNotification);
un.fired();
let _ = catch_unwind(|| {
let un: &mut UnlockNotification = &mut *(*arg as *mut UnlockNotification);
un.fired()
});
}
}