summary refs log tree commit diff
path: root/src/libnm-glib-aux/nm-ref-string.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/libnm-glib-aux/nm-ref-string.h')
-rw-r--r--src/libnm-glib-aux/nm-ref-string.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libnm-glib-aux/nm-ref-string.h b/src/libnm-glib-aux/nm-ref-string.h
index c7cfe87f..45313b39 100644
--- a/src/libnm-glib-aux/nm-ref-string.h
+++ b/src/libnm-glib-aux/nm-ref-string.h
@@ -83,7 +83,8 @@ nm_ref_string_unref(NMRefString *rstr)
 
     /* fast-path: first try to decrement the ref-count without bringing it
      * to zero. */
-    r = rstr->_ref_count;
+    r = g_atomic_int_get(&rstr->_ref_count);
+
     if (G_LIKELY(r > 1 && g_atomic_int_compare_and_exchange(&rstr->_ref_count, r, r - 1)))
         return;