freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Git][freetype/freetype][master] 2 commits: * src/cache/ftcmru.c (FTC_Mr


From: Alexei Podtelezhnikov (@apodtele)
Subject: [Git][freetype/freetype][master] 2 commits: * src/cache/ftcmru.c (FTC_MruList_New): Do not reset nodes.
Date: Mon, 29 Apr 2024 22:06:10 +0000

Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType

Commits:

  • f8f0d1a1
    by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-04-29T16:58:59-04:00
    * src/cache/ftcmru.c (FTC_MruList_New): Do not reset nodes.
    
    Resetting of the size nodes can crash, if a parent face purge happens
    simultaneously and destroys the node. It is safer to create a new node.
    Fixes #1270, reopened with a separate issue.
    
  • a209e1ad
    by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-04-29T17:54:30-04:00
    [cache] Remove unused `node_reset`.
    
    * src/cache/ftcmru.h (FTC_MruListClassRec): Remove `node_reset` field.
    * src/cache/ftcbasic.c (ftc_basic_{image,sbit}_family_class): Ditto.
    * src/cache/ftcmanag.c (ftc_face_list_class): Ditto.
    (ftc_size_node_reset): Remove function.
    * src/cache/ftcglyph.h: Fix comment.
    

5 changed files:

Changes:

  • src/cache/ftcbasic.c
    ... ... @@ -243,7 +243,6 @@
    243 243
     
    
    244 244
           ftc_basic_family_compare, /* FTC_MruNode_CompareFunc  node_compare */
    
    245 245
           ftc_basic_family_init,    /* FTC_MruNode_InitFunc     node_init    */
    
    246
    -      NULL,                     /* FTC_MruNode_ResetFunc    node_reset   */
    
    247 246
           NULL                      /* FTC_MruNode_DoneFunc     node_done    */
    
    248 247
         },
    
    249 248
     
    
    ... ... @@ -421,7 +420,6 @@
    421 420
           sizeof ( FTC_BasicFamilyRec ),
    
    422 421
           ftc_basic_family_compare,     /* FTC_MruNode_CompareFunc  node_compare */
    
    423 422
           ftc_basic_family_init,        /* FTC_MruNode_InitFunc     node_init    */
    
    424
    -      NULL,                         /* FTC_MruNode_ResetFunc    node_reset   */
    
    425 423
           NULL                          /* FTC_MruNode_DoneFunc     node_done    */
    
    426 424
         },
    
    427 425
     
    

  • src/cache/ftcglyph.h
    ... ... @@ -65,7 +65,6 @@
    65 65
        * - FTC_Family sub-class, e.g. MyFamily, with relevant methods:
    
    66 66
        *     my_family_compare
    
    67 67
        *     my_family_init
    
    68
    -   *     my_family_reset (optional)
    
    69 68
        *     my_family_done
    
    70 69
        *
    
    71 70
        * - FTC_GQuery sub-class, e.g. MyQuery, to hold cache-specific query
    

  • src/cache/ftcmanag.c
    ... ... @@ -133,31 +133,6 @@
    133 133
       }
    
    134 134
     
    
    135 135
     
    
    136
    -  FT_CALLBACK_DEF( FT_Error )
    
    137
    -  ftc_size_node_reset( FTC_MruNode  ftcnode,
    
    138
    -                       FT_Pointer   ftcscaler,
    
    139
    -                       FT_Pointer   ftcmanager )
    
    140
    -  {
    
    141
    -    FT_Error      error;
    
    142
    -    FT_Size       size;
    
    143
    -    FTC_SizeNode  node    = (FTC_SizeNode)ftcnode;
    
    144
    -    FTC_Scaler    scaler  = (FTC_Scaler)ftcscaler;
    
    145
    -    FTC_Manager   manager = (FTC_Manager)ftcmanager;
    
    146
    -
    
    147
    -
    
    148
    -    error = ftc_scaler_lookup_size( manager, scaler, &size );
    
    149
    -    if ( !error )
    
    150
    -    {
    
    151
    -      FT_Done_Size( node->size );
    
    152
    -
    
    153
    -      node->size   = size;
    
    154
    -      node->scaler = scaler[0];
    
    155
    -    }
    
    156
    -
    
    157
    -    return error;
    
    158
    -  }
    
    159
    -
    
    160
    -
    
    161 136
       static
    
    162 137
       const FTC_MruListClassRec  ftc_size_list_class =
    
    163 138
       {
    
    ... ... @@ -165,7 +140,6 @@
    165 140
     
    
    166 141
         ftc_size_node_compare,  /* FTC_MruNode_CompareFunc  node_compare */
    
    167 142
         ftc_size_node_init,     /* FTC_MruNode_InitFunc     node_init    */
    
    168
    -    ftc_size_node_reset,    /* FTC_MruNode_ResetFunc    node_reset   */
    
    169 143
         ftc_size_node_done      /* FTC_MruNode_DoneFunc     node_done    */
    
    170 144
       };
    
    171 145
     
    
    ... ... @@ -307,7 +281,6 @@
    307 281
     
    
    308 282
         ftc_face_node_compare,  /* FTC_MruNode_CompareFunc  node_compare */
    
    309 283
         ftc_face_node_init,     /* FTC_MruNode_InitFunc     node_init    */
    
    310
    -    NULL,                   /* FTC_MruNode_ResetFunc    node_reset   */
    
    311 284
         ftc_face_node_done      /* FTC_MruNode_DoneFunc     node_done    */
    
    312 285
       };
    
    313 286
     
    

  • src/cache/ftcmru.c
    ... ... @@ -242,27 +242,6 @@
    242 242
         FT_Memory    memory = list->memory;
    
    243 243
     
    
    244 244
     
    
    245
    -    if ( list->max_nodes > 0 && list->num_nodes >= list->max_nodes )
    
    246
    -    {
    
    247
    -      prev = list->nodes->prev;
    
    248
    -
    
    249
    -      FT_ASSERT( prev );
    
    250
    -
    
    251
    -      /* try fast reset when available */
    
    252
    -      if ( list->clazz.node_reset )
    
    253
    -      {
    
    254
    -        error = list->clazz.node_reset( prev, key, list->data );
    
    255
    -        if ( !error )
    
    256
    -        {
    
    257
    -          node = prev;
    
    258
    -
    
    259
    -          FTC_MruNode_Up( &list->nodes, node );
    
    260
    -        }
    
    261
    -
    
    262
    -        goto Exit;
    
    263
    -      }
    
    264
    -    }
    
    265
    -
    
    266 245
         /* zero new node in case of node_init failure */
    
    267 246
         if ( FT_ALLOC( node, list->clazz.node_size ) )
    
    268 247
           goto Exit;
    
    ... ... @@ -275,6 +254,8 @@
    275 254
     
    
    276 255
           goto Clean;
    
    277 256
         }
    
    257
    +    else if ( list->max_nodes > 0 && list->num_nodes >= list->max_nodes )
    
    258
    +      prev = list->nodes->prev;
    
    278 259
     
    
    279 260
         FTC_MruNode_Prepend( &list->nodes, node );
    
    280 261
         list->num_nodes++;
    

  • src/cache/ftcmru.h
    ... ... @@ -95,11 +95,6 @@ FT_BEGIN_HEADER
    95 95
                                FT_Pointer   key,
    
    96 96
                                FT_Pointer   data );
    
    97 97
     
    
    98
    -  typedef FT_Error
    
    99
    -  (*FTC_MruNode_ResetFunc)( FTC_MruNode  node,
    
    100
    -                            FT_Pointer   key,
    
    101
    -                            FT_Pointer   data );
    
    102
    -
    
    103 98
       typedef void
    
    104 99
       (*FTC_MruNode_DoneFunc)( FTC_MruNode  node,
    
    105 100
                                FT_Pointer   data );
    
    ... ... @@ -111,7 +106,6 @@ FT_BEGIN_HEADER
    111 106
     
    
    112 107
         FTC_MruNode_CompareFunc  node_compare;
    
    113 108
         FTC_MruNode_InitFunc     node_init;
    
    114
    -    FTC_MruNode_ResetFunc    node_reset;
    
    115 109
         FTC_MruNode_DoneFunc     node_done;
    
    116 110
     
    
    117 111
       } FTC_MruListClassRec;
    


  • reply via email to

    [Prev in Thread] Current Thread [Next in Thread]