Skip to content

Release settings accessibility servers before DLL unload - #40

Draft
YellowNest wants to merge 1 commit into
masterfrom
fix/settings-accessibility-server-lifetime
Draft

YellowNest wants to merge 1 commit into
masterfrom
fix/settings-accessibility-server-lifetime

Conversation

@YellowNest

Copy link
Copy Markdown
Owner

Summary

Release the MSAA dynamic-annotation servers owned by the settings trees before their hosting DLL can be unloaded.

Root cause

The accessibility work from Open-Shell#2518 registers CSettingsTreeAccServer instances through IAccPropServices::SetHwndPropServer.

Those registrations can outlive the settings dialog unless they are explicitly cleared. After Open-Shell exits, StartMenuDLL may be unloaded while oleacc still retains marshaled references to those servers. A later accessibility annotation can trigger CPropMgrImpl::Clean, which then attempts to call CSettingsTreeAccServer::Release() through the stale vtable address in the unloaded module.

That matches the crash in Open-Shell#2556.

Changes

  • add a full settings-tree accessibility cleanup helper
  • clear all per-item state/name/role annotations before item handles disappear
  • clear the tree-level container annotation and accessible name
  • run cleanup from both settings-tree destroy paths while child HWNDs are still valid
  • keep the existing partial item cleanup used when trees are rebuilt during normal dialog use

Validation

Static review completed against current upstream master. Build and runtime validation pending.

@YellowNest
YellowNest force-pushed the fix/settings-accessibility-server-lifetime branch from f374cb0 to bde7bf0 Compare October 7, 2026 19:15
@YellowNest
YellowNest force-pushed the fix/settings-accessibility-server-lifetime branch from 51e504b to 34cc2c2 Compare October 7, 2026 19:16
@ge0rdi

ge0rdi commented Oct 7, 2026

Copy link
Copy Markdown

I have created Open-Shell#2557 PR in the meantime.
I think it does the same as yours, just a bit simpler.

Can you have a look?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants