* 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.
diff --git a/src/cache/ftcmru.c b/src/cache/ftcmru.c
index a767fa4..f908eb2 100644
--- a/src/cache/ftcmru.c
+++ b/src/cache/ftcmru.c
@@ -242,27 +242,6 @@
FT_Memory memory = list->memory;
- if ( list->max_nodes > 0 && list->num_nodes >= list->max_nodes )
- {
- prev = list->nodes->prev;
-
- FT_ASSERT( prev );
-
- /* try fast reset when available */
- if ( list->clazz.node_reset )
- {
- error = list->clazz.node_reset( prev, key, list->data );
- if ( !error )
- {
- node = prev;
-
- FTC_MruNode_Up( &list->nodes, node );
- }
-
- goto Exit;
- }
- }
-
/* zero new node in case of node_init failure */
if ( FT_ALLOC( node, list->clazz.node_size ) )
goto Exit;
@@ -275,6 +254,8 @@
goto Clean;
}
+ else if ( list->max_nodes > 0 && list->num_nodes >= list->max_nodes )
+ prev = list->nodes->prev;
FTC_MruNode_Prepend( &list->nodes, node );
list->num_nodes++;