mirror of
https://github.com/harfbuzz/harfbuzz.git
synced 2025-04-13 08:42:59 +00:00
[font/ft] See if tsan is happy with atomic_int_t serials
This commit is contained in:
parent
6ae7ef0659
commit
aa268fc8ef
4 changed files with 17 additions and 9 deletions
|
@ -186,6 +186,8 @@ struct hb_atomic_int_t
|
|||
|
||||
hb_atomic_int_t& operator = (int v_) { set_relaxed (v_); return *this; }
|
||||
operator int () const { return get_relaxed (); }
|
||||
int operator ++ (int) { return inc (); }
|
||||
int operator -- (int) { return dec (); }
|
||||
|
||||
void set_relaxed (int v_) { hb_atomic_int_impl_set_relaxed (&v, v_); }
|
||||
void set_release (int v_) { hb_atomic_int_impl_set (&v, v_); }
|
||||
|
|
|
@ -2744,7 +2744,8 @@ hb_font_set_variations (hb_font_t *font,
|
|||
if (hb_object_is_immutable (font))
|
||||
return;
|
||||
|
||||
font->serial_coords = ++font->serial;
|
||||
font->serial++;
|
||||
font->serial_coords = font->serial;
|
||||
|
||||
if (!variations_length && font->instance_index == HB_FONT_NO_VAR_NAMED_INSTANCE)
|
||||
{
|
||||
|
@ -2814,7 +2815,8 @@ hb_font_set_variation (hb_font_t *font,
|
|||
if (hb_object_is_immutable (font))
|
||||
return;
|
||||
|
||||
font->serial_coords = ++font->serial;
|
||||
font->serial++;
|
||||
font->serial_coords = font->serial;
|
||||
|
||||
// TODO Share some of this code with set_variations()
|
||||
|
||||
|
@ -2886,7 +2888,8 @@ hb_font_set_var_coords_design (hb_font_t *font,
|
|||
if (hb_object_is_immutable (font))
|
||||
return;
|
||||
|
||||
font->serial_coords = ++font->serial;
|
||||
font->serial++;
|
||||
font->serial_coords = font->serial;
|
||||
|
||||
int *normalized = coords_length ? (int *) hb_calloc (coords_length, sizeof (int)) : nullptr;
|
||||
float *design_coords = coords_length ? (float *) hb_calloc (coords_length, sizeof (float)) : nullptr;
|
||||
|
@ -2924,7 +2927,8 @@ hb_font_set_var_named_instance (hb_font_t *font,
|
|||
if (font->instance_index == instance_index)
|
||||
return;
|
||||
|
||||
font->serial_coords = ++font->serial;
|
||||
font->serial++;
|
||||
font->serial_coords = font->serial;
|
||||
|
||||
font->instance_index = instance_index;
|
||||
hb_font_set_variations (font, nullptr, 0);
|
||||
|
@ -2971,7 +2975,8 @@ hb_font_set_var_coords_normalized (hb_font_t *font,
|
|||
if (hb_object_is_immutable (font))
|
||||
return;
|
||||
|
||||
font->serial_coords = ++font->serial;
|
||||
font->serial++;
|
||||
font->serial_coords = font->serial;
|
||||
|
||||
int *copy = coords_length ? (int *) hb_calloc (coords_length, sizeof (coords[0])) : nullptr;
|
||||
int *unmapped = coords_length ? (int *) hb_calloc (coords_length, sizeof (coords[0])) : nullptr;
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "hb.hh"
|
||||
|
||||
#include "hb-face.hh"
|
||||
#include "hb-atomic.hh"
|
||||
#include "hb-shaper.hh"
|
||||
|
||||
|
||||
|
@ -105,8 +106,8 @@ DECLARE_NULL_INSTANCE (hb_font_funcs_t);
|
|||
struct hb_font_t
|
||||
{
|
||||
hb_object_header_t header;
|
||||
unsigned int serial;
|
||||
unsigned int serial_coords;
|
||||
hb_atomic_int_t serial;
|
||||
hb_atomic_int_t serial_coords;
|
||||
|
||||
hb_font_t *parent;
|
||||
hb_face_t *face;
|
||||
|
|
|
@ -101,7 +101,7 @@ struct hb_ft_font_t
|
|||
|
||||
mutable hb_mutex_t lock; /* Protects members below. */
|
||||
FT_Face ft_face;
|
||||
mutable unsigned cached_serial;
|
||||
mutable hb_atomic_int_t cached_serial;
|
||||
mutable hb_ft_advance_cache_t advance_cache;
|
||||
};
|
||||
|
||||
|
@ -118,7 +118,7 @@ _hb_ft_font_create (FT_Face ft_face, bool symbol, bool unref)
|
|||
|
||||
ft_font->load_flags = FT_LOAD_DEFAULT | FT_LOAD_NO_HINTING;
|
||||
|
||||
ft_font->cached_serial = (unsigned) -1;
|
||||
ft_font->cached_serial = -1;
|
||||
new (&ft_font->advance_cache) hb_ft_advance_cache_t;
|
||||
|
||||
return ft_font;
|
||||
|
|
Loading…
Add table
Reference in a new issue