Thank him for me.
I think the fix is in LabelG. The XmCalcLabelGDimensions() of
the superclass wasn't initialising these fields when there was
no accelerator text.
Can you check whether the attached patch solves the problem ?
It does the same thing in the widget.
It doesn't seem to solve the 'set acceleratortext' bug you
pointed me to a while ago. (I want to tackle that soon, no
time until now.)
Danny
On Fri, 2004-09-03 at 19:16, Dave Williss wrote:
> One of our other software engineers found this error when running a
> Lesstif-based program through Purify.
> The line in question is [togglebg.c:796]...
>
> LabG_AccTextRect(new_w).x += margin;
>
> And apparently LabG_AccTextRect(new_w) isn't initialized.
--
Danny Backx - danny.backx-at-planetinternet.be http://up.to/danny.backx
? x1
Index: Label.c
===================================================================
RCS file: /cvsroot/lesstif/lesstif/lib/Xm-2.1/Label.c,v
retrieving revision 1.1
diff -c -r1.1 Label.c
*** Label.c 28 Aug 2004 19:22:44 -0000 1.1
--- Label.c 4 Sep 2004 05:31:04 -0000
***************
*** 1875,1882 ****
&Lab_TextRect_height(w));
}
! if (Lab_AcceleratorText(w))
! {
_XmStringExtent(Lab_Font(w), Lab_AcceleratorText(w),
&Lab_AccTextRect(w).width,
&Lab_AccTextRect(w).height);
--- 1875,1881 ----
&Lab_TextRect_height(w));
}
! if (Lab_AcceleratorText(w)) {
_XmStringExtent(Lab_Font(w), Lab_AcceleratorText(w),
&Lab_AccTextRect(w).width,
&Lab_AccTextRect(w).height);
***************
*** 1884,1889 ****
--- 1883,1893 ----
{
Lab_AccTextRect(w).height = 0;
}
+ } else {
+ Lab_AccTextRect(w).height = 0;
+ Lab_AccTextRect(w).width = 0;
+ Lab_AccTextRect(w).x = 0;
+ Lab_AccTextRect(w).y = 0;
}
_XmObjectUnlock(w);
}
Index: LabelG.c
===================================================================
RCS file: /cvsroot/lesstif/lesstif/lib/Xm-2.1/LabelG.c,v
retrieving revision 1.1
diff -c -r1.1 LabelG.c
*** LabelG.c 28 Aug 2004 19:22:44 -0000 1.1
--- LabelG.c 4 Sep 2004 05:31:04 -0000
***************
*** 562,576 ****
&LabG_TextRect_height(w));
}
! if (LabG_AcceleratorText(w))
! {
_XmStringExtent(LabG_Font(w), LabG_AcceleratorText(w),
&LabG_AccTextRect(w).width,
&LabG_AccTextRect(w).height);
! if (!LabG_AccTextRect(w).width)
! {
LabG_AccTextRect(w).height = 0;
}
}
}
--- 562,580 ----
&LabG_TextRect_height(w));
}
! if (LabG_AcceleratorText(w)) {
_XmStringExtent(LabG_Font(w), LabG_AcceleratorText(w),
&LabG_AccTextRect(w).width,
&LabG_AccTextRect(w).height);
! if (!LabG_AccTextRect(w).width) {
LabG_AccTextRect(w).height = 0;
}
+ } else {
+ /* No accelerator text -> no dimensions */
+ LabG_AccTextRect(w).height = 0;
+ LabG_AccTextRect(w).width = 0;
+ LabG_AccTextRect(w).x = 0;
+ LabG_AccTextRect(w).y = 0;
}
}