summaryrefslogtreecommitdiff
path: root/pango/pango-attributes.c
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2008-08-22 07:20:04 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2008-08-22 07:20:04 +0000
commit3b4ce828245be692017fd1fb498952e3c4238074 (patch)
treec5e5a261d23425d336f8a5aaae3b23166e3cec01 /pango/pango-attributes.c
parentd8b4b188b676b9cdb3f33a599fc2a77051c6938c (diff)
downloadpango-3b4ce828245be692017fd1fb498952e3c4238074.tar.gz
Use atomic reference counting.
2008-08-22 Behdad Esfahbod <behdad@gnome.org> * pango/fonts.c (pango_font_metrics_ref), (pango_font_metrics_unref): * pango/pango-attributes.c (pango_attr_list_ref), (pango_attr_list_unref): * pango/pango-coverage.c (pango_coverage_ref), (pango_coverage_unref): * pango/pango-layout.c (pango_layout_line_ref), (pango_layout_line_unref): * pango/pangowin32-fontcache.c (cache_entry_unref), (pango_win32_font_cache_loadw): * pango/pangox-fontcache.c (cache_entry_unref), (pango_x_font_cache_load): Use atomic reference counting. Pango may not be thread safe yet, but fixing it little by little is easier than doing all in one round. svn path=/trunk/; revision=2705
Diffstat (limited to 'pango/pango-attributes.c')
-rw-r--r--pango/pango-attributes.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/pango/pango-attributes.c b/pango/pango-attributes.c
index 3a0be40b..5e5e5857 100644
--- a/pango/pango-attributes.c
+++ b/pango/pango-attributes.c
@@ -1131,7 +1131,7 @@ pango_attr_list_ref (PangoAttrList *list)
if (list == NULL)
return NULL;
- list->ref_count++;
+ g_atomic_int_inc (&list->ref_count);
return list;
}
@@ -1154,8 +1154,7 @@ pango_attr_list_unref (PangoAttrList *list)
g_return_if_fail (list->ref_count > 0);
- list->ref_count--;
- if (list->ref_count == 0)
+ if (g_atomic_int_dec_and_test (&list->ref_count))
{
tmp_list = list->attributes;
while (tmp_list)