On Fri, 26 Aug 2005 23:03:33 +0200
Michael Jung <[EMAIL PROTECTED]> wrote:
> Every time you double click a folder, the current ShellView object is
> destroyed and a new one is created. Given that I have to browse into like 30
> different folders before it crashes on me, I can't pin down the relevant
> infoPtr.
In hunt for this bug, I discovered the following:
* It appears both with unixfs and normal Wine fs.
* Every double click on a folder in the listview destroys this listview
object (effectively destroying all underlying structures), creates a new
one, and returns control to the place where double click notification was
sent by the old listview (notify_hdr() function in listview.c). This time
the old listview and its structures are already destroyed, but we
continue to access them, exception!
Here is a patch which adds checking if the window has been destroyed at
that point. I don't know if it is acceptable but it fixes the problem.
ChangeLog:
Protect against wrong memory access if a listview is destroyed in a handler
for its NM_DBLCLK notification.
-- Ph.
Index: dlls/comctl32/listview.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/listview.c,v
retrieving revision 1.429
diff -p -u -r1.429 listview.c
--- dlls/comctl32/listview.c 30 Aug 2005 10:07:17 -0000 1.429
+++ dlls/comctl32/listview.c 8 Sep 2005 16:58:43 -0000
@@ -8083,6 +8083,7 @@ static LRESULT LISTVIEW_KillFocus(LISTVI
static LRESULT LISTVIEW_LButtonDblClk(LISTVIEW_INFO *infoPtr, WORD wKey, INT x, INT y)
{
LVHITTESTINFO htInfo;
+ HWND hwnd = infoPtr->hwndSelf;
TRACE("(key=%hu, X=%hu, Y=%hu)\n", wKey, x, y);
@@ -8095,7 +8096,15 @@ static LRESULT LISTVIEW_LButtonDblClk(LI
/* send NM_DBLCLK notification */
LISTVIEW_HitTest(infoPtr, &htInfo, TRUE, FALSE);
notify_click(infoPtr, NM_DBLCLK, &htInfo);
-
+
+ /* If during NM_DBLCLK processing the control was destroyed, don't try
+ * to continue execution, it's unsafe */
+ if (!IsWindow(hwnd))
+ {
+ WARN("the control has been destroyed in NM_DBLCLK processing\n");
+ return 0;
+ }
+
/* To send the LVN_ITEMACTIVATE, it must be on an Item */
if(htInfo.iItem != -1) notify_itemactivate(infoPtr,&htInfo);