Skip to content

Commit 7432f32

Browse files
authored
Drop use of volatile with g_once_*() (#97)
1 parent 90bdf10 commit 7432f32

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

flutter/third_party/accessibility/ax/platform/ax_platform_atk_hyperlink.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,11 +248,11 @@ static void AXPlatformAtkHyperlinkInit(AXPlatformAtkHyperlink* self, gpointer) {
248248
}
249249

250250
GType ax_platform_atk_hyperlink_get_type() {
251-
static volatile gsize type_volatile = 0;
251+
static gsize type_id = 0;
252252

253253
AXPlatformNodeAuraLinux::EnsureGTypeInit();
254254

255-
if (g_once_init_enter(&type_volatile)) {
255+
if (g_once_init_enter(&type_id)) {
256256
static const GTypeInfo tinfo = {
257257
sizeof(AXPlatformAtkHyperlinkClass),
258258
(GBaseInitFunc) nullptr,
@@ -273,10 +273,10 @@ GType ax_platform_atk_hyperlink_get_type() {
273273
GType type = g_type_register_static(
274274
ATK_TYPE_HYPERLINK, "AXPlatformAtkHyperlink", &tinfo, GTypeFlags(0));
275275
g_type_add_interface_static(type, ATK_TYPE_ACTION, &actionInfo);
276-
g_once_init_leave(&type_volatile, type);
276+
g_once_init_leave(&type_id, type);
277277
}
278278

279-
return type_volatile;
279+
return type_id;
280280
}
281281

282282
} // namespace ui

flutter/third_party/accessibility/ax/platform/ax_platform_node_auralinux.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2248,8 +2248,8 @@ void ClassInit(gpointer class_pointer, gpointer /* class_data */) {
22482248
GType GetType() {
22492249
AXPlatformNodeAuraLinux::EnsureGTypeInit();
22502250

2251-
static volatile gsize type_volatile = 0;
2252-
if (g_once_init_enter(&type_volatile)) {
2251+
static gsize type_id = 0;
2252+
if (g_once_init_enter(&type_id)) {
22532253
static const GTypeInfo type_info = {
22542254
sizeof(AXPlatformNodeAuraLinuxClass), // class_size
22552255
nullptr, // base_init
@@ -2265,10 +2265,10 @@ GType GetType() {
22652265

22662266
GType type = g_type_register_static(
22672267
ATK_TYPE_OBJECT, "AXPlatformNodeAuraLinux", &type_info, GTypeFlags(0));
2268-
g_once_init_leave(&type_volatile, type);
2268+
g_once_init_leave(&type_id, type);
22692269
}
22702270

2271-
return type_volatile;
2271+
return type_id;
22722272
}
22732273

22742274
void Detach(AXPlatformNodeAuraLinuxObject* atk_object) {

0 commit comments

Comments
 (0)