[PATCH 3/5] shell32: Make LV_RenameItem delete destinations that already exist.

Nigel Baillie metreckk at gmail.com
Tue Feb 26 18:19:24 CST 2019


With interrupt-level shell notifications, it's possible for a rename to
have the same destination as an existing entry. Without this check,
such renames result in duplicate items in the list view.

Signed-off-by: Nigel Baillie <metreckk at gmail.com>
---
 dlls/shell32/shlview.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/dlls/shell32/shlview.c b/dlls/shell32/shlview.c
index c0c027fbd3..478a78ee2d 100644
--- a/dlls/shell32/shlview.c
+++ b/dlls/shell32/shlview.c
@@ -608,6 +608,11 @@ static BOOLEAN LV_RenameItem(IShellViewImpl * This, LPCITEMIDLIST pidlOld, LPCIT
 
 	TRACE("(%p)(pidlold=%p pidlnew=%p)\n", This, pidlOld, pidlNew);
 
+	/* if the destination already exists, remove it */
+	nItem = LV_FindItemByPidl(This, ILFindLastID(pidlNew));
+	if ( -1 != nItem )
+		SendMessageW(This->hWndList, LVM_DELETEITEM, nItem, 0);
+
 	nItem = LV_FindItemByPidl(This, ILFindLastID(pidlOld));
 	if ( -1 != nItem )
 	{
-- 
2.20.1




More information about the wine-devel mailing list