mirror of
https://github.com/Open-Shell/Open-Shell-Menu.git
synced 2026-10-08 11:39:06 +11:00
Release settings accessibility servers before DLL unload (#2558)
This commit is contained in:
@@ -140,10 +140,8 @@ void EnableSettingsTreeAccessibility( HWND tree )
|
||||
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};
|
||||
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 )
|
||||
{
|
||||
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 )
|
||||
{
|
||||
ClearSettingsTreeAccessibility(m_Tree);
|
||||
DestroyIcon(m_PlayIcon);
|
||||
bHandled=FALSE;
|
||||
m_EditMode=EDIT_NONE;
|
||||
|
||||
@@ -19,6 +19,7 @@ struct CSetting;
|
||||
// by Open-Shell's existing image list.
|
||||
void EnableSettingsTreeAccessibility( HWND tree );
|
||||
void ClearSettingsTreeItemAccessibility( HWND tree );
|
||||
void ClearSettingsTreeAccessibility( HWND tree );
|
||||
void SetControlAccessibleName( HWND control, const wchar_t *name );
|
||||
void SetSettingsTreeAccessibleName( HWND tree, 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 )
|
||||
{
|
||||
ClearSettingsTreeAccessibility(m_Tree);
|
||||
m_EditMode=SKIN_OPTION_NONE;
|
||||
bHandled=FALSE;
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user