mirror of
https://github.com/emilk/egui.git
synced 2026-08-30 05:10:03 -04:00
This is a temporary fix to not unsafe impl Sync + Send for backends
The problem is that when we call Context::create_viewport_sync can be on any thread because egui::Context is Sync + Send but the backend is not! So we want the callback to the backend to be thread local! The problem that this adds is that now you cannot create more then one egui::Context, because the thread local variabile is static and i don't know how to store a non static LocalKey on egui::ContextImpl
This commit is contained in:
@@ -538,11 +538,6 @@ mod glow_integration {
|
||||
builders: HashMap<ViewportId, ViewportBuilder>,
|
||||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
unsafe impl Sync for GlutinWindowContext {}
|
||||
#[allow(unsafe_code)]
|
||||
unsafe impl Send for GlutinWindowContext {}
|
||||
|
||||
impl GlutinWindowContext {
|
||||
/// There is a lot of complexity with opengl creation, so prefer extensive logging to get all the help we can to debug issues.
|
||||
///
|
||||
@@ -1889,11 +1884,6 @@ mod wgpu_integration {
|
||||
#[derive(Clone)]
|
||||
pub struct Viewports(Arc<RwLock<HashMap<ViewportId, Window>>>);
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
unsafe impl Send for Viewports {}
|
||||
#[allow(unsafe_code)]
|
||||
unsafe impl Sync for Viewports {}
|
||||
|
||||
impl std::ops::Deref for Viewports {
|
||||
type Target = Arc<RwLock<HashMap<ViewportId, Window>>>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user