SEGV when application creates string menu item with NULL text

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



While rude, this is possible under Windows, but results in a SEGV under Wine. 
The following patch eliminates the SEGV.

Index: controls/menu.c
===================================================================
RCS file: /home/wine/wine/controls/menu.c,v
retrieving revision 1.163
diff -u -r1.163 menu.c
--- controls/menu.c	7 Mar 2003 23:03:27 -0000	1.163
+++ controls/menu.c	22 Sep 2003 03:26:10 -0000
@@ -938,7 +938,10 @@
     if (!(lpitem->fType & MF_SYSMENU) && IS_STRING_ITEM( lpitem->fType ))
     {   SIZE size;
 
-	GetTextExtentPoint32W(hdc, lpitem->text,  strlenW(lpitem->text), &size);
+	if (lpitem->text)
+	    GetTextExtentPoint32W(hdc, lpitem->text,  strlenW(lpitem->text), &size);
+	else
+	    size.cx = size.cy = 0;
 
 	lpitem->rect.right  += size.cx;
 	if (TWEAK_WineLook == WIN31_LOOK)
@@ -951,6 +954,10 @@
 	{
 	     lpitem->rect.right += MENU_BAR_ITEMS_SPACE;
 	}
+	else if (!lpitem->text)
+	{
+		/* Do nothing */
+	}
 	else if ((p = strchrW( lpitem->text, '\t' )) != NULL)
 	{
 	    /* Item contains a tab (only meaningful in popup menus) */
@@ -1360,7 +1367,7 @@
 
     }
     /* No bitmap - process text if present */
-    else if (IS_STRING_ITEM(lpitem->fType))
+    else if (IS_STRING_ITEM(lpitem->fType) && lpitem->text)
     {
 	register int i;
 	HFONT hfontOld = 0;



[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux