Release settings accessibility servers before DLL unload (#2558)

This commit is contained in:
YellowNest
2026-10-07 22:02:16 +02:00
committed by GitHub
parent a43cf39441
commit e1fe220d18
3 changed files with 25 additions and 3 deletions
+23 -3
View File
@@ -140,10 +140,8 @@ void EnableSettingsTreeAccessibility( HWND tree )
server->Release(); server->Release();
} }
void ClearSettingsTreeItemAccessibility( HWND tree ) static void ClearSettingsTreeItemAccessibilityImpl( IAccPropServices *props, HWND tree )
{ {
CComPtr<IAccPropServices> props;
if (FAILED(CoCreateInstance(CLSID_SettingsAccPropServices,NULL,CLSCTX_INPROC_SERVER,IID_PPV_ARGS(&props)))) return;
MSAAPROPID properties[]={PROPID_SettingsAccState,PROPID_SettingsAccName,PROPID_SettingsAccRole}; MSAAPROPID properties[]={PROPID_SettingsAccState,PROPID_SettingsAccName,PROPID_SettingsAccRole};
for (HTREEITEM item=TreeView_GetRoot(tree);item;) for (HTREEITEM item=TreeView_GetRoot(tree);item;)
{ {
@@ -159,6 +157,27 @@ void ClearSettingsTreeItemAccessibility( HWND tree )
} }
} }
void ClearSettingsTreeItemAccessibility( HWND tree )
{
if (!tree || !IsWindow(tree)) return;
CComPtr<IAccPropServices> props;
if (FAILED(CoCreateInstance(CLSID_SettingsAccPropServices,NULL,CLSCTX_INPROC_SERVER,IID_PPV_ARGS(&props)))) return;
ClearSettingsTreeItemAccessibilityImpl(props,tree);
}
void ClearSettingsTreeAccessibility( HWND tree )
{
if (!tree || !IsWindow(tree)) return;
CComPtr<IAccPropServices> props;
if (FAILED(CoCreateInstance(CLSID_SettingsAccPropServices,NULL,CLSCTX_INPROC_SERVER,IID_PPV_ARGS(&props)))) return;
// Release all per-item servers while their accessibility IDs can still be
// resolved, then remove the container server and the tree-level name.
ClearSettingsTreeItemAccessibilityImpl(props,tree);
MSAAPROPID properties[]={PROPID_SettingsAccState,PROPID_SettingsAccName,PROPID_SettingsAccRole};
props->ClearHwndProps(tree,OBJID_CLIENT,CHILDID_SELF,properties,_countof(properties));
}
void SetControlAccessibleName( HWND control, const wchar_t *name ) void SetControlAccessibleName( HWND control, const wchar_t *name )
{ {
CComPtr<IAccPropServices> props; CComPtr<IAccPropServices> props;
@@ -2778,6 +2797,7 @@ LRESULT CTreeSettingsDlg::OnInitDialog( UINT uMsg, WPARAM wParam, LPARAM lParam,
LRESULT CTreeSettingsDlg::OnDestroy( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled ) LRESULT CTreeSettingsDlg::OnDestroy( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled )
{ {
ClearSettingsTreeAccessibility(m_Tree);
DestroyIcon(m_PlayIcon); DestroyIcon(m_PlayIcon);
bHandled=FALSE; bHandled=FALSE;
m_EditMode=EDIT_NONE; m_EditMode=EDIT_NONE;
+1
View File
@@ -19,6 +19,7 @@ struct CSetting;
// by Open-Shell's existing image list. // by Open-Shell's existing image list.
void EnableSettingsTreeAccessibility( HWND tree ); void EnableSettingsTreeAccessibility( HWND tree );
void ClearSettingsTreeItemAccessibility( HWND tree ); void ClearSettingsTreeItemAccessibility( HWND tree );
void ClearSettingsTreeAccessibility( HWND tree );
void SetControlAccessibleName( HWND control, const wchar_t *name ); void SetControlAccessibleName( HWND control, const wchar_t *name );
void SetSettingsTreeAccessibleName( HWND tree, const wchar_t *name ); void SetSettingsTreeAccessibleName( HWND tree, const wchar_t *name );
void SetSettingsTreeItemAccessibleName( HWND tree, HTREEITEM item, const wchar_t *name ); void SetSettingsTreeItemAccessibleName( HWND tree, HTREEITEM item, const wchar_t *name );
@@ -285,6 +285,7 @@ LRESULT CSkinSettingsDlg::OnInitDialog( UINT uMsg, WPARAM wParam, LPARAM lParam,
LRESULT CSkinSettingsDlg::OnDestroy( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled ) LRESULT CSkinSettingsDlg::OnDestroy( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled )
{ {
ClearSettingsTreeAccessibility(m_Tree);
m_EditMode=SKIN_OPTION_NONE; m_EditMode=SKIN_OPTION_NONE;
bHandled=FALSE; bHandled=FALSE;
return 0; return 0;