Stop TOOLBAR_MeasureString from dying on empty strings
Charles Duffy
cduffy at bigfoot.com
Fri Feb 22 20:03:20 CST 2002
The attached patch prevents the strlenW from trying to dereference
lpText if TOOLBAR_GetText returned NULL. This bug affects, potentially
among other apps, Morpheus.
-------------- next part --------------
? wineFixToolbarSegfault.patch
? dlls/comctl32/toolbar.c.annotate
? dlls/comctl32/toolbar.c.diff
? documentation/wine.conf.man
? if1632/asmrelay.s
? loader/dos/dosmod
? tools/specmaker/specmaker
Index: dlls/comctl32/toolbar.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/toolbar.c,v
retrieving revision 1.103
diff -u -r1.103 toolbar.c
--- dlls/comctl32/toolbar.c 2002/02/12 18:43:56 1.103
+++ dlls/comctl32/toolbar.c 2002/02/22 23:58:22
@@ -819,22 +819,24 @@
{
LPWSTR lpText = TOOLBAR_GetText(infoPtr, btnPtr);
- /* first get size of all the text */
- GetTextExtentPoint32W (hdc, lpText, strlenW (lpText), lpSize);
+ if(lpText != NULL) {
+ /* first get size of all the text */
+ GetTextExtentPoint32W (hdc, lpText, strlenW (lpText), lpSize);
- /* feed above size into the rectangle for DrawText */
- myrect.left = myrect.top = 0;
- myrect.right = lpSize->cx;
- myrect.bottom = lpSize->cy;
+ /* feed above size into the rectangle for DrawText */
+ myrect.left = myrect.top = 0;
+ myrect.right = lpSize->cx;
+ myrect.bottom = lpSize->cy;
- /* Use DrawText to get true size as drawn (less pesky "&") */
- DrawTextW (hdc, lpText, -1, &myrect, DT_VCENTER | DT_SINGLELINE |
- DT_CALCRECT | ((btnPtr->fsStyle & TBSTYLE_NOPREFIX) ?
+ /* Use DrawText to get true size as drawn (less pesky "&") */
+ DrawTextW (hdc, lpText, -1, &myrect, DT_VCENTER | DT_SINGLELINE |
+ DT_CALCRECT | ((btnPtr->fsStyle & TBSTYLE_NOPREFIX) ?
DT_NOPREFIX : 0));
- /* feed back to caller */
- lpSize->cx = myrect.right;
- lpSize->cy = myrect.bottom;
+ /* feed back to caller */
+ lpSize->cx = myrect.right;
+ lpSize->cy = myrect.bottom;
+ }
}
TRACE("string size %ld x %ld!\n", lpSize->cx, lpSize->cy);
More information about the wine-patches
mailing list