Просмотр исходного кода

Release old element decorator data after generating new data

This gives the decorator the opportunity to reuse any cached resources. Particularly helpful for the SVG cache.
Michael Ragazzon 7 месяцев назад
Родитель
Сommit
6ebe3df0ac
1 измененных файлов с 5 добавлено и 2 удалено
  1. 5 2
      Source/Core/ElementEffects.cpp

+ 5 - 2
Source/Core/ElementEffects.cpp

@@ -162,12 +162,15 @@ void ElementEffects::ReloadEffectsData()
 		{
 			for (DecoratorEntry& decorator : *list)
 			{
-				if (decorator.decorator_data)
-					decorator.decorator->ReleaseElementData(decorator.decorator_data);
+				const DecoratorDataHandle old_data = decorator.decorator_data;
 
 				decorator.decorator_data = decorator.decorator->GenerateElementData(element, decorator.paint_area);
 				if (!decorator.decorator_data)
 					decorator_data_failed = true;
+
+				// Release old element data after generating new data, so that the decorator can reuse any cache.
+				if (old_data)
+					decorator.decorator->ReleaseElementData(old_data);
 			}
 		}