Bug#379011: vim-lesstif: gvim always crashes during startup

2006-09-30 Thread Christian Aichinger
On Sun, Aug 27, 2006 at 03:41:35AM +0100, Ben Hutchings wrote:
 XmEnhancedButton doesn't initially have an XmPrimitiveClassExtRec of its
 own (primitive_class.extension is NULL) so I'm not sure how it gets one.
 Using a copy of the record from XmPushButton works around the bug in
 vim:

This has now been worked around on the vim side, cf. #378721.

Does this bug still severely affect other packages? I.e. can we
downgrade to important?

Cheers,
Christian Aichinger


signature.asc
Description: Digital signature


Bug#379011: vim-lesstif: gvim always crashes during startup

2006-08-26 Thread Ben Hutchings
The function in which the crash occurs is:

Boolean
XmWidgetGetBaselines(Widget w, Dimension **baselines, int *line_count)
{
if (XmIsLabel(w))
{
XmPrimitiveClassExt *extptr;

extptr = _XmGetPrimitiveClassExtPtr(XtClass(w), NULLQUARK);

if (extptr  *extptr  (*extptr)-widget_baseline)
{
return ((*extptr)-widget_baseline) (w, baselines, line_count);
}
}
else if (XmIsLabelGadget(w))
{
XmGadgetClassExt *extptr;

extptr = _XmGetGadgetClassExtPtr(XtClass(w), NULLQUARK);

if (extptr  *extptr  (*extptr)-widget_baseline)
{
return ((*extptr)-widget_baseline) (w, baselines, line_count);
}
}

return False;
}

In this case the widget class is XmEnhancedButton, which is
vim-lesstif's subclass of XmPushButton, which is a subclass of XmLabel.
extptr ends up pointing to a structure with garbage in the
widget_baseline and following fields; I suspect it's some other sort of
extension record and not an XmPrimitiveClassExtRec.  (The backtrace in
gdb shows that we're in the second conditional block, despite the fact
the widget meets the first condition.  This is because at optimisation
level 2 gcc combines the common code of the two blocks and the debug
information doesn't show that there are two possible line numbers.)

XmEnhancedButton doesn't initially have an XmPrimitiveClassExtRec of its
own (primitive_class.extension is NULL) so I'm not sure how it gets one.
Using a copy of the record from XmPushButton works around the bug in
vim:

--- vim70/src/gui_xmebw.c.orig  2006-08-27 01:28:52.0 +
+++ vim70/src/gui_xmebw.c   2006-08-27 01:30:04.0 +
@@ -138,6 +138,17 @@
 }
 };
 
+XmPrimitiveClassExtRec xmEnhancedButtonPrimClassExtRec =
+{
+/* next_extension  */ NULL,
+/* record_type */ NULLQUARK,
+/* version */ XmPrimitiveClassExtVersion,
+/* record_size */ sizeof(XmPrimitiveClassExtRec),
+/* widget_baseline */ XmInheritBaselineProc,
+/* widget_display_rect */ XmInheritDisplayRectProc,
+/* widget_margins  */ NULL
+};
+
 XmEnhancedButtonClassRec xmEnhancedButtonClassRec =
 {
 {
@@ -184,7 +195,7 @@
/* arm and activate  */ XmInheritArmAndActivate,
/* synthetic resources   */ NULL,
/* number of syn res */ 0,
-   /* extension */ NULL,
+   /* extension */ (XtPointer)xmEnhancedButtonPrimClassExtRec,
 },
 
 /* label_class fields */
-- END --

Ben.

-- 
Ben Hutchings -- [EMAIL PROTECTED] shortened to [EMAIL PROTECTED]
If you've signed my GPG key, please send a signature on and to the new uid.
I'm not a reverse psychological virus.  Please don't copy me into your sig.


signature.asc
Description: This is a digitally signed message part