Prechádzať zdrojové kódy

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 mesiacov pred
rodič
commit
6ebe3df0ac
1 zmenil súbory, kde vykonal 5 pridanie a 2 odobranie
  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);
 			}
 		}