mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 22:32:58 +00:00
[SHELL32]
- Take an extra reference on CDefView during the lifetime of the view window, and correctly handle recursive WM_DESTROY messages CORE-9932 svn path=/trunk/; revision=68761
This commit is contained in:
parent
b94bea6426
commit
fcd430d3a1
1 changed files with 36 additions and 7 deletions
|
@ -113,6 +113,7 @@ class CDefView :
|
||||||
|
|
||||||
CLSID m_Category;
|
CLSID m_Category;
|
||||||
HMENU m_hView;
|
HMENU m_hView;
|
||||||
|
BOOL m_Destroyed;
|
||||||
private:
|
private:
|
||||||
|
|
||||||
HRESULT _MergeToolbar();
|
HRESULT _MergeToolbar();
|
||||||
|
@ -248,6 +249,8 @@ class CDefView :
|
||||||
LRESULT OnEraseBackground(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
LRESULT OnEraseBackground(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
||||||
LRESULT OnSysColorChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
LRESULT OnSysColorChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
||||||
LRESULT OnGetShellBrowser(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
LRESULT OnGetShellBrowser(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
||||||
|
LRESULT OnNCCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
||||||
|
LRESULT OnNCDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
||||||
LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
||||||
LRESULT OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
LRESULT OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
||||||
LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
||||||
|
@ -296,6 +299,8 @@ class CDefView :
|
||||||
MESSAGE_HANDLER(WM_SIZE, OnSize)
|
MESSAGE_HANDLER(WM_SIZE, OnSize)
|
||||||
MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus)
|
MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus)
|
||||||
MESSAGE_HANDLER(WM_KILLFOCUS, OnKillFocus)
|
MESSAGE_HANDLER(WM_KILLFOCUS, OnKillFocus)
|
||||||
|
MESSAGE_HANDLER(WM_NCCREATE, OnNCCreate)
|
||||||
|
MESSAGE_HANDLER(WM_NCDESTROY, OnNCDestroy)
|
||||||
MESSAGE_HANDLER(WM_CREATE, OnCreate)
|
MESSAGE_HANDLER(WM_CREATE, OnCreate)
|
||||||
MESSAGE_HANDLER(WM_ACTIVATE, OnActivate)
|
MESSAGE_HANDLER(WM_ACTIVATE, OnActivate)
|
||||||
MESSAGE_HANDLER(WM_NOTIFY, OnNotify)
|
MESSAGE_HANDLER(WM_NOTIFY, OnNotify)
|
||||||
|
@ -364,7 +369,8 @@ CDefView::CDefView() :
|
||||||
m_iDragOverItem(0),
|
m_iDragOverItem(0),
|
||||||
m_cScrollDelay(0),
|
m_cScrollDelay(0),
|
||||||
m_isEditing(FALSE),
|
m_isEditing(FALSE),
|
||||||
m_hView(NULL)
|
m_hView(NULL),
|
||||||
|
m_Destroyed(FALSE)
|
||||||
{
|
{
|
||||||
ZeroMemory(&m_FolderSettings, sizeof(m_FolderSettings));
|
ZeroMemory(&m_FolderSettings, sizeof(m_FolderSettings));
|
||||||
ZeroMemory(&m_sortInfo, sizeof(m_sortInfo));
|
ZeroMemory(&m_sortInfo, sizeof(m_sortInfo));
|
||||||
|
@ -971,11 +977,20 @@ LRESULT CDefView::OnGetDlgCode(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bH
|
||||||
|
|
||||||
LRESULT CDefView::OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
|
LRESULT CDefView::OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
|
||||||
{
|
{
|
||||||
if (m_hMenu)
|
if (!m_Destroyed)
|
||||||
DestroyMenu(m_hMenu);
|
{
|
||||||
RevokeDragDrop(m_hWnd);
|
m_Destroyed = TRUE;
|
||||||
SHChangeNotifyDeregister(m_hNotify);
|
if (m_hMenu)
|
||||||
SHFree(m_pidlParent);
|
{
|
||||||
|
DestroyMenu(m_hMenu);
|
||||||
|
m_hMenu = NULL;
|
||||||
|
}
|
||||||
|
RevokeDragDrop(m_hWnd);
|
||||||
|
SHChangeNotifyDeregister(m_hNotify);
|
||||||
|
m_hNotify = NULL;
|
||||||
|
SHFree(m_pidlParent);
|
||||||
|
m_pidlParent = NULL;
|
||||||
|
}
|
||||||
bHandled = FALSE;
|
bHandled = FALSE;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1004,6 +1019,20 @@ LRESULT CDefView::OnGetShellBrowser(UINT uMsg, WPARAM wParam, LPARAM lParam, BOO
|
||||||
return reinterpret_cast<LRESULT>(m_pShellBrowser.p);
|
return reinterpret_cast<LRESULT>(m_pShellBrowser.p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LRESULT CDefView::OnNCCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
|
||||||
|
{
|
||||||
|
this->AddRef();
|
||||||
|
bHandled = FALSE;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT CDefView::OnNCDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
|
||||||
|
{
|
||||||
|
this->Release();
|
||||||
|
bHandled = FALSE;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**********************************************************
|
/**********************************************************
|
||||||
* ShellView_OnCreate()
|
* ShellView_OnCreate()
|
||||||
*/
|
*/
|
||||||
|
@ -2229,7 +2258,7 @@ HRESULT WINAPI CDefView::DestroyViewWindow()
|
||||||
if (m_hMenu)
|
if (m_hMenu)
|
||||||
{
|
{
|
||||||
DestroyMenu(m_hMenu);
|
DestroyMenu(m_hMenu);
|
||||||
m_hView = NULL;
|
m_hMenu = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_ListView)
|
if (m_ListView)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue