tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit e89552cb83b38b77e82a84f5c2c932291c2f7ff0
parent 26c4a68ff792488e72b2f1fb36b4d3ce6c273d3e
Author: Markus Stange <mstange.moz@gmail.com>
Date:   Tue,  7 Oct 2025 14:12:04 +0000

Bug 1992872 - Make sure to set aRootCALayer's sublayers if aRootCALayer changes. r=bradwerth

Differential Revision: https://phabricator.services.mozilla.com/D267680

Diffstat:
Mgfx/layers/NativeLayerCA.h | 5+++--
Mgfx/layers/NativeLayerCA.mm | 8+++++++-
2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/gfx/layers/NativeLayerCA.h b/gfx/layers/NativeLayerCA.h @@ -216,8 +216,9 @@ class NativeLayerRootCA final : public NativeLayerRoot { RefPtr<NativeLayerRootCA> mLayerRoot; }; - Mutex mMutex MOZ_UNANNOTATED; // protects all other fields - CALayer* mOnscreenRootCALayer = nullptr; // strong + Mutex mMutex MOZ_UNANNOTATED; // protects all other fields + CALayer* mOnscreenRootCALayer = nullptr; // strong + CALayer* mOffscreenRootCALayer = nullptr; // strong NativeLayerRootSnapshotterCA* mWeakSnapshotter = nullptr; nsTArray<RefPtr<NativeLayerCA>> mSublayers; // in z-order float mBackingScale = 1.0f; diff --git a/gfx/layers/NativeLayerCA.mm b/gfx/layers/NativeLayerCA.mm @@ -211,7 +211,7 @@ NativeLayerRootCA::~NativeLayerRootCA() { mSublayers.IsEmpty(), "Please clear all layers before destroying the layer root."); - if (mMutatedOnscreenLayerStructure || mMutatedOffscreenLayerStructure) { + { // Clear the root layer's sublayers. At this point the window is usually // closed, so this transaction does not cause any screen updates. AutoCATransaction transaction; @@ -219,6 +219,7 @@ NativeLayerRootCA::~NativeLayerRootCA() { } [mOnscreenRootCALayer release]; + [mOffscreenRootCALayer release]; } already_AddRefed<NativeLayer> NativeLayerRootCA::CreateLayer( @@ -402,6 +403,11 @@ void NativeLayerRootCA::OnNativeLayerRootSnapshotterDestroyed( void NativeLayerRootCA::CommitOffscreen(CALayer* aRootCALayer) { MutexAutoLock lock(mMutex); + if (aRootCALayer != mOffscreenRootCALayer) { + [mOffscreenRootCALayer release]; + mOffscreenRootCALayer = [aRootCALayer retain]; + mMutatedOffscreenLayerStructure = true; + } CommitRepresentation(WhichRepresentation::OFFSCREEN, aRootCALayer, mSublayers, mMutatedOffscreenLayerStructure, mWindowIsFullscreen); mMutatedOffscreenLayerStructure = false;