Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d97070b32b34fea5771d017193cf3180efdd82b8
      
https://github.com/WebKit/WebKit/commit/d97070b32b34fea5771d017193cf3180efdd82b8
  Author: Nikolas Zimmermann <[email protected]>
  Date:   2025-09-13 (Sat, 13 Sep 2025)

  Changed paths:
    M Source/WebCore/css/CSSPrimitiveValue.cpp
    M Source/WebCore/css/CSSValuePool.cpp
    M Source/WebCore/css/CSSValuePool.h

  Log Message:
  -----------
  Do not store LazyNeverDestroyed objects as member variables
https://bugs.webkit.org/show_bug.cgi?id=298814

Reviewed by Darin Adler.

Stop using LazyNeverDestroyed for member variables in StaticCSSValuePool.

This triggers undefined behavior in ASSERT_ENABLED builds, since the
'm_isConstructed' member of LazyNeverDestroyed<T> is not initialized
in that case. GCC 14 correctly warned about this, breaking the build
on e.g. Ubuntu 25.04, where GCC 14 is default.

The straightforward solution was to directly use AlignedStorage<T>
as type for the pool member variables instead of LazyNeverDestroyed<T>,
preserving the current performance characteristics (no dynamic
allocations, etc.). The "canonical" solution of using e.g.
Vector<RefPtr<CSSPrimitiveValue>> would re-introduce the memory
problems which were previously migitiated by introducing
std::array<LazyNeverDestroyed<...>, capacity> -- thus it is not
applicable here.

Covered by existing tests.

* Source/WebCore/css/CSSPrimitiveValue.cpp:
(WebCore::valueFromPool):
* Source/WebCore/css/CSSValuePool.cpp:
(WebCore::StaticCSSValuePool::StaticCSSValuePool):
(WebCore::CSSValuePool::createColorValue):
* Source/WebCore/css/CSSValuePool.h:
(WebCore::CSSPrimitiveValue::implicitInitialValue):
(WebCore::CSSPrimitiveValue::create):

Canonical link: https://commits.webkit.org/299936@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to