diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h index f97262ffa..eeb8dcbcc 100644 --- a/include/freetype/internal/ftobjs.h +++ b/include/freetype/internal/ftobjs.h @@ -386,7 +386,7 @@ FT_BEGIN_HEADER FT_Char no_stem_darkening; FT_Int32 random_seed; - FT_Int refcount; + FT_UInt refcount; } FT_Face_InternalRec; @@ -916,7 +916,7 @@ FT_BEGIN_HEADER FT_Vector lcd_geometry[3]; /* RGB subpixel positions */ #endif - FT_Int refcount; + FT_UInt refcount; } FT_LibraryRec; diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index acefdf46f..2c73df47a 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -2838,8 +2838,6 @@ internal->transform_delta.x = 0; internal->transform_delta.y = 0; - internal->refcount = 1; - internal->no_stem_darkening = -1; } @@ -2970,9 +2968,11 @@ error = FT_ERR( Invalid_Face_Handle ); if ( face && face->driver ) { - face->internal->refcount--; if ( face->internal->refcount > 0 ) + { + face->internal->refcount--; error = FT_Err_Ok; + } else { driver = face->driver; @@ -5525,8 +5525,6 @@ library->version_minor = FREETYPE_MINOR; library->version_patch = FREETYPE_PATCH; - library->refcount = 1; - /* That's ok now */ *alibrary = library; @@ -5576,9 +5574,11 @@ if ( !library ) return FT_THROW( Invalid_Library_Handle ); - library->refcount--; if ( library->refcount > 0 ) + { + library->refcount--; goto Exit; + } memory = library->memory;