Skip to content

Commit 64c305c

Browse files
committed
fix concurrency issues in macro helper attribute 'enum_dynamic'
Signed-off-by: fbrouille <[email protected]>
1 parent 0cce920 commit 64c305c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

glib-macros/src/enum_derive.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ fn register_enum_as_dynamic(
398398
/// Do nothing as the enum has been registered on implementation load.
399399
#[inline]
400400
fn register_enum() -> #crate_ident::Type {
401-
let gtype = #gtype_status.load(::std::sync::atomic::Ordering::Relaxed);
401+
let gtype = #gtype_status.load(::std::sync::atomic::Ordering::Acquire);
402402
unsafe { <#crate_ident::Type as #crate_ident::translate::FromGlib<#crate_ident::ffi::GType>>::from_glib(gtype) }
403403
}
404404

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

0 commit comments

Comments
 (0)