diff --git a/reactos/base/applications/regedit/childwnd.c b/reactos/base/applications/regedit/childwnd.c index b5135cb94ce..f656498a3d6 100644 --- a/reactos/base/applications/regedit/childwnd.c +++ b/reactos/base/applications/regedit/childwnd.c @@ -439,8 +439,8 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa } goto def; case WM_DESTROY: - DestroyTreeView(); DestroyListView(g_pChildWnd->hListWnd); + DestroyTreeView(g_pChildWnd->hTreeWnd); DestroyMainMenu(); HeapFree(GetProcessHeap(), 0, g_pChildWnd); g_pChildWnd = NULL; diff --git a/reactos/base/applications/regedit/main.h b/reactos/base/applications/regedit/main.h index 46ade6bf2fd..1060c2f9dd0 100644 --- a/reactos/base/applications/regedit/main.h +++ b/reactos/base/applications/regedit/main.h @@ -129,9 +129,9 @@ extern HTREEITEM InsertNode(HWND hwndTV, HTREEITEM hItem, LPWSTR name); extern HWND StartKeyRename(HWND hwndTV); extern BOOL CreateNewKey(HWND hwndTV, HTREEITEM hItem); extern BOOL SelectNode(HWND hwndTV, LPCWSTR keyPath); -extern void DestroyTreeView( void ); -extern void DestroyListView( HWND hwndLV ); -extern void DestroyMainMenu( void ); +extern void DestroyTreeView(HWND hwndTV); +extern void DestroyListView(HWND hwndLV); +extern void DestroyMainMenu(void); /* edit.c */ extern BOOL ModifyValue(HWND hwnd, HKEY hKey, LPCWSTR valueName, BOOL EditBin); diff --git a/reactos/base/applications/regedit/treeview.c b/reactos/base/applications/regedit/treeview.c index fbd05d75898..0f1a7706839 100644 --- a/reactos/base/applications/regedit/treeview.c +++ b/reactos/base/applications/regedit/treeview.c @@ -651,10 +651,15 @@ HWND CreateTreeView(HWND hwndParent, LPWSTR pHostName, HMENU id) return hwndTV; } -void DestroyTreeView() +void DestroyTreeView(HWND hwndTV) { - if (pathBuffer) - HeapFree(GetProcessHeap(), 0, pathBuffer); + HIMAGELIST himl; + + if (pathBuffer) HeapFree(GetProcessHeap(), 0, pathBuffer); + + /* Destroy the image list associated with the tree view control */ + himl = TreeView_GetImageList(hwndTV, TVSIL_NORMAL); + if (himl) ImageList_Destroy(himl); } BOOL SelectNode(HWND hwndTV, LPCWSTR keyPath)