Fix toolbar memory fault

Dave Hawkes daveh at cadlink.com
Fri Dec 7 15:40:23 CST 2001


Fix for toolbar potentially using a NULL pointer.

Dave Hawkes

-------------- next part --------------
Index: dlls/comctl32/toolbar.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/toolbar.c,v
retrieving revision 1.96
diff -u -r1.96 toolbar.c
--- dlls/comctl32/toolbar.c	2001/12/05 22:10:26	1.96
+++ dlls/comctl32/toolbar.c	2001/12/07 19:57:27
@@ -205,6 +205,9 @@
 static INT
 TOOLBAR_SendNotify (NMHDR *nmhdr, TOOLBAR_INFO *infoPtr, UINT code)
 {
+	if(!IsWindow(infoPtr->hwndSelf))
+	    return 0;   /* we have just been destroyed */
+	
     nmhdr->idFrom = GetDlgCtrlID (infoPtr->hwndSelf);
     nmhdr->hwndFrom = infoPtr->hwndSelf;
     nmhdr->code = code;
@@ -1415,7 +1418,7 @@
     PCUSTDLG_INFO custInfo = (PCUSTDLG_INFO)GetWindowLongA (hwnd, DWL_USER);
     PCUSTOMBUTTON btnInfo;
     NMTOOLBARA nmtb;
-    TOOLBAR_INFO *infoPtr = custInfo->tbInfo;
+    TOOLBAR_INFO *infoPtr = custInfo ? custInfo->tbInfo : NULL;
 
     switch (uMsg)
     {
@@ -1428,6 +1431,8 @@
 		char Buffer[256];
 		int i = 0;
 		int index;
+		
+		infoPtr = custInfo->tbInfo;
 
 		/* send TBN_QUERYINSERT notification */
 		nmtb.iItem = custInfo->tbInfo->nNumButtons;


More information about the wine-patches mailing list