Skip to content

DataGridHeaderBorder.CacheFreezable method does not actually cache freezable brushes #6713

@ghost

Description

Code:

private static void CacheFreezable(Freezable freezable, int index)

The logic is backwards in that it only caches if the indexed value is not null, versus caching if the indexed value is null. This will result in freezable values never being cached and any calls to GetCachedFreezable will always return a null value causing brushes to be created every time a rendering pass is performed for the specific theme.

The code should instead be:

        private static void CacheFreezable(Freezable freezable, int index)
        {
            Debug.Assert(freezable.IsFrozen, "Cached Freezables should be frozen.");

            lock (_cacheAccess)
            {
                if (_freezableCache[index] == null)
                {
                    _freezableCache[index] = freezable;
                }
            }
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions