Skip to content

Commit

Permalink
fix concurrency issues in macro helper attribute 'enum_dynamic'
Browse files Browse the repository at this point in the history
Signed-off-by: fbrouille <fbrouille@users.noreply.github.com>
  • Loading branch information
fbrouille committed Dec 27, 2023
1 parent 0cce920 commit 64c305c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions glib-macros/src/enum_derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ fn register_enum_as_dynamic(
/// Do nothing as the enum has been registered on implementation load.
#[inline]
fn register_enum() -> #crate_ident::Type {
let gtype = #gtype_status.load(::std::sync::atomic::Ordering::Relaxed);
let gtype = #gtype_status.load(::std::sync::atomic::Ordering::Acquire);
unsafe { <#crate_ident::Type as #crate_ident::translate::FromGlib<#crate_ident::ffi::GType>>::from_glib(gtype) }
}

Expand All @@ -408,7 +408,7 @@ fn register_enum_as_dynamic(
pub fn on_implementation_load(type_plugin: &#plugin_ty) -> bool {
static VALUES: #enum_values;
let gtype = #crate_ident::translate::IntoGlib::into_glib(<#plugin_ty as glib::prelude::DynamicObjectRegisterExt>::register_dynamic_enum(type_plugin, #gtype_name, VALUES.as_ref()));
#gtype_status.store(gtype, ::std::sync::atomic::Ordering::Relaxed);
#gtype_status.store(gtype, ::std::sync::atomic::Ordering::Release);
gtype != #crate_ident::gobject_ffi::G_TYPE_INVALID
}

Expand Down

0 comments on commit 64c305c

Please sign in to comment.