summaryrefslogtreecommitdiff
path: root/girepository/gibaseinfo.c
diff options
context:
space:
mode:
Diffstat (limited to 'girepository/gibaseinfo.c')
-rw-r--r--girepository/gibaseinfo.c41
1 files changed, 25 insertions, 16 deletions
diff --git a/girepository/gibaseinfo.c b/girepository/gibaseinfo.c
index ff9c9395..4bbe850a 100644
--- a/girepository/gibaseinfo.c
+++ b/girepository/gibaseinfo.c
@@ -71,6 +71,17 @@ _g_info_new_full (GIInfoType type,
return (GIBaseInfo*)info;
}
+/**
+ * g_info_new:
+ * @type: TODO
+ * @container: TODO
+ * @typelib: TODO
+ * @offset: TODO
+ *
+ * TODO
+ *
+ * Returns: TODO
+ */
GIBaseInfo *
g_info_new (GIInfoType type,
GIBaseInfo *container,
@@ -169,8 +180,8 @@ _g_type_info_init (GIBaseInfo *info,
/**
* SECTION:gibaseinfo
- * @Short_description: Base struct for all GITypelib structs
- * @Title: GIBaseInfo
+ * @title: GIBaseInfo
+ * @short_description: Base struct for all GITypelib structs
*
* GIBaseInfo is the common base struct of all other *Info structs
* accessible through the #GIRepository API.
@@ -209,7 +220,6 @@ _g_type_info_init (GIBaseInfo *info,
* +----<link linkend="gi-GITypeInfo">GITypeInfo</link>
* </synopsis>
* </refsect1>
- *
*/
/**
@@ -226,7 +236,7 @@ g_base_info_ref (GIBaseInfo *info)
GIRealInfo *rinfo = (GIRealInfo*)info;
g_assert (rinfo->ref_count != INVALID_REFCOUNT);
- ((GIRealInfo*)info)->ref_count++;
+ g_atomic_int_inc (&rinfo->ref_count);
return info;
}
@@ -244,21 +254,20 @@ g_base_info_unref (GIBaseInfo *info)
GIRealInfo *rinfo = (GIRealInfo*)info;
g_assert (rinfo->ref_count > 0 && rinfo->ref_count != INVALID_REFCOUNT);
- rinfo->ref_count--;
- if (!rinfo->ref_count)
- {
- if (rinfo->container && ((GIRealInfo *) rinfo->container)->ref_count != INVALID_REFCOUNT)
- g_base_info_unref (rinfo->container);
+ if (!g_atomic_int_dec_and_test (&rinfo->ref_count))
+ return;
- if (rinfo->repository)
- g_object_unref (rinfo->repository);
+ if (rinfo->container && ((GIRealInfo *) rinfo->container)->ref_count != INVALID_REFCOUNT)
+ g_base_info_unref (rinfo->container);
- if (rinfo->type == GI_INFO_TYPE_UNRESOLVED)
- g_slice_free (GIUnresolvedInfo, (GIUnresolvedInfo *) rinfo);
- else
- g_slice_free (GIRealInfo, rinfo);
- }
+ if (rinfo->repository)
+ g_object_unref (rinfo->repository);
+
+ if (rinfo->type == GI_INFO_TYPE_UNRESOLVED)
+ g_slice_free (GIUnresolvedInfo, (GIUnresolvedInfo *) rinfo);
+ else
+ g_slice_free (GIRealInfo, rinfo);
}
/**