[PATCH] comdlg32: Avoid passing NULL to FILEDLG95_LOOKIN_InsertItemAfterParent. (try 2)

Lei Zhang thestig at google.com
Thu Dec 4 18:29:41 CST 2008


Hi,

This is my second attempt to fix bug 16332. We can make sure
FILEDLG95_LOOKIN_InsertItemAfterParent() doesn't infinite loop by
always giving it a non-null pidl. The Desktop folder seems like a
sensible default.

This version frees the pidl from SHGetSpecialFolderLocation() and has
two space indentations instead of four.
-------------- next part --------------
From fa2a019e72ec6a848b3c507f7f10636d410cebcc Mon Sep 17 00:00:00 2001
From: Lei Zhang <thestig at google.com>
Date: Thu, 4 Dec 2008 16:27:59 -0800
Subject: [PATCH] comdlg32: Avoid passing NULL to FILEDLG95_LOOKIN_InsertItemAfterParent.

---
 dlls/comdlg32/filedlg.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/dlls/comdlg32/filedlg.c b/dlls/comdlg32/filedlg.c
index e1eedd1..d860098 100644
--- a/dlls/comdlg32/filedlg.c
+++ b/dlls/comdlg32/filedlg.c
@@ -2917,9 +2917,16 @@ int FILEDLG95_LOOKIN_SelectItem(HWND hwnd,LPITEMIDLIST pidl)
 {
   int iItemPos;
   LookInInfos *liInfos;
+  BOOL bFreePidl = FALSE;
 
   TRACE("\n");
 
+  if (!pidl)
+  {
+    SHGetSpecialFolderLocation(0,CSIDL_DESKTOP,&pidl);
+    bFreePidl = TRUE;
+  }
+
   iItemPos = FILEDLG95_LOOKIN_SearchItem(hwnd,(WPARAM)pidl,SEARCH_PIDL);
 
   liInfos = GetPropA(hwnd,LookInInfosStr);
@@ -2946,6 +2953,8 @@ int FILEDLG95_LOOKIN_SelectItem(HWND hwnd,LPITEMIDLIST pidl)
 
   CBSetCurSel(hwnd,iItemPos);
   liInfos->uSelectedItem = iItemPos;
+  if (bFreePidl)
+    COMDLG32_SHFree(pidl);
 
   return 0;
 
-- 
1.5.4.5


More information about the wine-patches mailing list