Open Bug 2097506 Opened 3 days ago Updated 3 days ago

Crash in [@ Microsoft::WRL::Details::RuntimeClassImpl<T>::Release]

Categories

(Core :: Widget: Win32, defect)

defect

Tracking

()

Tracking Status
firefox-esr115 --- unaffected
firefox-esr153 --- unaffected
firefox161 --- unaffected
firefox162 --- unaffected
firefox163 --- affected

People

(Reporter: clouseau-bot, Unassigned, NeedInfo)

References

(Blocks 1 open bug, Regression)

Details

(Keywords: crash, regression)

Crash Data

Crash report: https://crash-stats.mozilla.org/report/index/0cba4468-5d61-4e7e-83c6-a55b60261125

Crash Reason:

EXCEPTION_ACCESS_VIOLATION_READ at 0x000001b24bae0fdc

Top 10 frames:

0  Microsoft.UI.Windowing.Core.dll  Microsoft::WRL::Details::RuntimeClassImpl<Microsoft::WRL::RuntimeClassFlags<2>, ...
1  Microsoft.UI.Windowing.Core.dll  CTitleBarCaptionButtonsFragmentProvider::`vector deleting destructor'(unsigned i...
2  Microsoft.UI.Windowing.Core.dll  Microsoft::WRL::Details::RuntimeClassImpl<Microsoft::WRL::RuntimeClassFlags<2>, ...
3  Microsoft.UI.Windowing.Core.dll  CTitleBar::Uninitialize(void)
4  Microsoft.UI.Windowing.Core.dll  Windowing::AppWindowTitleBar::UninitializeTitleBarNative(void)
5  Microsoft.UI.Windowing.Core.dll  Windowing::AppWindowTitleBar::Api_IAppWindowTitleBar_ResetToDefault$(void)
6  Microsoft.UI.Windowing.Core.dll  Api::IAppWindowTitleBar::ExportAdapter$::ResetToDefault(void)
7  xul.dll  WindowsUIUtils::SetIsTitlebarCollapsed(HWND__*, bool)  widget/windows/WindowsUIUtils.cpp:1282
8  xul.dll  nsWindow::Destroy()  widget/windows/nsWindow.cpp:1314
9  xul.dll  mozilla::AppWindow::Destroy()  xpfe/appshell/AppWindow.cpp:554

There is 1 crash in nightly 163 with buildid 20261123184640.

This signature is not new: its first report anywhere is in build 20120614114901 (2012-06-14), 5275 days before the build above. (A 364-day crash-stats search only reaches 2025-12-17, because Socorro's search index keeps about six months — which is why the signature looks much newer there.)

Timing check: this signature was already being reported in build 20251217121356, 340 days before the changeset named below landed, so that changeset cannot be what INTRODUCED this SIGNATURE. It may still be relevant, and it may still be the cause of the crash in this particular report — an old signature can acquire a new cause, and a rare crash can be made frequent by a change that did not create it — but the signature's own history is not evidence that it is. Clouseau lowered its own confidence one step for that, and then put it back: an independent blind re-analysis, given none of the reasoning above, still agreed the changeset can cause this crash. The confidence stated below is that restored one.

Hardware-error share of this signature: of its 2 reports on this channel over the last year, 50% carry a possible-bit-flip annotation (Firefox-nightly population: 2%).

Clouseau analysis (automated, 72% worth investigating — a calibrated estimate that this is worth someone's time, not that the changeset below caused it). The mechanism below fits the evidence but is not proven end-to-end:

Closing a window with a custom titlebar now calls the Windows App SDK ResetToDefault() during nsWindow::Destroy, and that teardown probably releases an accessibility provider that is already freed.

  1. 5f8d2f008e40 added a call to WindowsUIUtils::SetIsTitlebarCollapsed(mWnd, false) in nsWindow::Destroy when mCustomNonClient is set and shutdown is not yet confirmed.
  2. With aIsCollapsed == false, SetIsTitlebarCollapsed calls titleBar->ResetToDefault() (WindowsUIUtils.cpp:1282).
  3. Inside the Windows App SDK, ResetToDefault runs AppWindowTitleBar::UninitializeTitleBarNative and then CTitleBar::Uninitialize, which releases CTitleBarCaptionButtonsFragmentProvider.
  4. That provider's destructor calls Release on a child WRL object (IRawElementProviderSimple/IRawElementProviderFragment/IInvokeProvider), and the read at [rcx+0x1c] probably hits freed memory.

The stack runs exactly through the added line (frame #8, nsWindow.cpp:1314), and the build is one day after the landing. Several reports under this signature fault at addresses ending in ...fdc, which fits a freed object read at a fixed offset rather than a bit flip. ResetToDefault itself was already reachable from the older runtime caller at nsWindow.cpp:2916, and the free happens in closed-source SDK code. So the change is more likely the exposer of an SDK lifetime problem, and only reports that run through nsWindow::Destroy are explained by it.

Build 20261123184640 is the first nightly after 5f8d2f008e40 landed (2026-11-22). Frame #8 is the added line 1314, and frame #7 is the ResetToDefault branch. The repeated ...fdc low bits across reports argue against the bit-flip annotation, but some of those reports predate the change and may come through other paths, such as the runtime caller at nsWindow.cpp:2916.

Suspected regressor: 5f8d2f008e40 (gh) (bug 2096020) by :florian.

Impact

The parent process crashes, so the whole browser closes.

Possible fixes

  • Possibly restore the ShouldAssociateWithWinAppSDK() guard from the first version (eeb70c96e27e) on the nsWindow::Destroy call, so destruction only resets title bars of windows that were actually associated with the Windows App SDK.
  • Possibly release the GDI objects another way that does not run CTitleBar::Uninitialize while UI Automation may still hold the caption-button provider (for example, resetting earlier, before accessibility teardown or close handling), keeping the call synchronous on the main thread.
  • If the free proves to be inside the Windows App SDK, report it to Microsoft and skip the reset in Destroy when it is known to be unsafe (for example, while an accessibility client is active).

How to confirm

On Windows 11 with Mica/custom titlebar, open and close browser windows repeatedly while a UI Automation client is attached (Narrator, Accessibility Insights, or a VM guest tool), and run under page heap (gflags /p /enable firefox.exe /full). A reproducible fault in CTitleBar::Uninitialize from nsWindow::Destroy would confirm it. Crash-stats: count reports of this signature with nsWindow::Destroy in the proto signature before and after build 20261123.

Code references:

What the automated skeptic pass checked

In its own words (a pass means the check succeeded, which is not always support for the conclusion):

  • unverifiable bitflip — Bit flip is unlikely: many reports share the low bits ...fdc at different high addresses, which fits a freed object read at a fixed offset. The free is inside Windows App SDK and cannot be inspected. Older reports under the generic signature predate the change.
  • pass hunk0 — Blame at build rev attributes nsWindow.cpp lines 1307-1316 to 5f8d2f008e40. Frame #8 at line 1314 is exactly the added call.
  • pass mechanism — ResetToDefault() is only reached with aIsCollapsed == false (WindowsUIUtils.cpp:1279-1283 at build rev). That branch is older (3a1c00fdacc9, 2025-11-28).
  • pass edge0 — Narrowed claim: the only other caller, nsWindow.cpp:2916, could already reach ResetToDefault at runtime. Calling it during nsWindow::Destroy is what is new, and this crash goes through the new caller. The new caller also skips the ShouldAssociateWithWinAppSDK() check used at line 2915; no evidence here that this matters.
  • pass eeb70c96e27e/01c9bd96fe07 — Earlier version of the same patch (guarded by ShouldAssociateWithWinAppSDK()), reverted by 01c9bd96fe07. The build contains the reland 5f8d2f008e40, so the reland is the one to look at.

:florian, can you have a look please?

Filed automatically by Clouseau with an LLM, from a submitted crash report: not an independent Mozilla discovery

Filed automatically by Clouseau, which analyses nightly crashes with an LLM. Nothing above was written or checked by a human. Please close it as INVALID if it is wrong — that is useful feedback, not a nuisance.

This is not an independent Mozilla discovery: the crash is known here only because somebody submitted the crash report linked at the top. If this duplicates an existing report, please resolve THIS bug as the duplicate and leave the credit with the earlier reporter.

Flags: needinfo?(florian)

Set release status flags based on info from the regressing bug 2096020

You need to log in before you can comment on or make changes to this bug.