diff --git a/src/lib.rs b/src/lib.rs index 25d3855..4028f25 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -37,7 +37,7 @@ pub type Renderbuffer = ::Renderbuffer; pub type Query = ::Query; pub type UniformLocation = ::UniformLocation; pub type TransformFeedback = ::TransformFeedback; -pub type DebugCallback = Box; +pub type DebugCallback = Box; pub struct ActiveUniform { pub size: i32, @@ -1191,7 +1191,7 @@ pub trait HasContext { unsafe fn debug_message_callback(&mut self, callback: F) where - F: FnMut(u32, u32, u32, u32, &str) + 'static; + F: FnMut(u32, u32, u32, u32, &str) + Send + Sync + 'static; unsafe fn get_debug_message_log(&self, count: u32) -> Vec; diff --git a/src/native.rs b/src/native.rs index 4016b26..22bb16f 100644 --- a/src/native.rs +++ b/src/native.rs @@ -19,6 +19,9 @@ struct DebugCallbackRawPtr { callback: *mut std::os::raw::c_void, } +unsafe impl Send for DebugCallbackRawPtr {} +unsafe impl Sync for DebugCallbackRawPtr {} + impl Drop for DebugCallbackRawPtr { fn drop(&mut self) { unsafe { @@ -2707,7 +2710,7 @@ impl HasContext for Context { unsafe fn debug_message_callback(&mut self, callback: F) where - F: FnMut(u32, u32, u32, u32, &str) + 'static, + F: FnMut(u32, u32, u32, u32, &str) + Send + Sync + 'static, { match self.debug_callback { Some(_) => {