Nickolay Pakoulin wrote:
XEmacs 21.4-14 hangs when editres client asks 'Select widget in
client'.
XEmacs 21.5 does not hang.
To reproduce.
Start xemacs
$ xemacs-21.4.14 -vanilla
Start editres
$ editres
In editres from menu 'Commands' issue the command 'Get Tree' and click
on
XEmacs frame. The editres pane will display the tree of XEmacs widgets.
Then in editres from 'Tree' menu issue the command 'Select Widget in
Client'.
Click on XEmacs toolbar. Editres says that request is sent to the client,
XEmacs hangs, some time after Editres says that "it appears that this client
does not understand the Editres Protocol".
XEmacs prints in the console:
xemacs: X Error of failed request: BadWindow (invalid Window parameter)
Major opcode of failed request: 3 (X_GetWindowAttributes)
Resource id in failed request: 0x0
Serial number of failed request: 1797
Current serial number in output stream: 1798
Attaching to the process with GDB gives the following backtrace:
(gdb) where
#0 0xffffe002 in ?? ()
#1 0x401bfbd7 in _XRead () from /usr/X11R6/lib/libX11.so.6
#2 0x401c071d in _XReply () from /usr/X11R6/lib/libX11.so.6
#3 0x401aa3e7 in XGetWindowAttributes () from /usr/X11R6/lib/libX11.so.6
#4 0x40120c46 in _XEditResCheckMessages () from /usr/X11R6/lib/libXmu.so.6
#5 0x40120d0a in _XEditResCheckMessages () from /usr/X11R6/lib/libXmu.so.6
#6 0x40120d56 in _XEditResCheckMessages () from /usr/X11R6/lib/libXmu.so.6
#7 0x40120df0 in _XEditResCheckMessages () from /usr/X11R6/lib/libXmu.so.6
#8 0x4011f8de in _XEditResCheckMessages () from /usr/X11R6/lib/libXmu.so.6
#9 0x4011f843 in _XEditResCheckMessages () from /usr/X11R6/lib/libXmu.so.6
#10 0x40159f88 in XtDisownSelection () from /usr/X11R6/lib/libXt.so.6
#11 0x4015a2bf in XtDisownSelection () from /usr/X11R6/lib/libXt.so.6
#12 0x4014564d in _XtFreeWWTable () from /usr/X11R6/lib/libXt.so.6
#13 0x4014582d in XtDispatchEventToWidget () from /usr/X11R6/lib/libXt.so.6
#14 0x4014625d in _XtOnGrabList () from /usr/X11R6/lib/libXt.so.6
#15 0x4014657f in XtDispatchEvent () from /usr/X11R6/lib/libXt.so.6
#16 0x4015272b in XtAppProcessEvent () from /usr/X11R6/lib/libXt.so.6
#17 0x0823a1e8 in emacs_Xt_next_event (emacs_event=0x85dbcec) at
/localhome/npak/src/xemacs-21.4.14/src/event-Xt.c:2750
[snip]
I get the same result here (BadWindow error for X_GetWindowAttributes,
XEmacs hangs).
However, I note that it only applies to the toolbar. Selecting
scrollbars or the EmacsFrame widget works correctly. Selecting the
menu bar identifies the Shell rather than the menu bar itself, but
doesn't hang.
Also, I have a more informative backtrace (my X libs have debug info):
#0 0x405200de in __select () from /lib/libc.so.6
#1 0x40383d2c in __DTOR_END__ () from /usr/X11R6/lib/libX11.so.6
#2 0x402f6c67 in _XRead (dpy=0x864f0b0, data=0xbfffbb9c "\n\003r\006.",
size=32) at XlibInt.c:1037
#3 0x402f76a3 in _XReply (dpy=0x864f0b0, rep=0xbfffbb9c, extra=0, discard=1)
at XlibInt.c:1672
#4 0x402e2f32 in XGetWindowAttributes (dpy=0x864f0b0, w=0, attr=0xbfffbbe8)
at GetWAttrs.c:113
#5 0x40263073 in PositionInChild (child=0x87469a0, x=368, y=41)
at EditresCom.c:1351
#6 0x40263127 in _FindChild (parent=0x86fd658, x=368, y=41)
at EditresCom.c:1384
#7 0x402631cb in DoFindChild (w=0x86fc158, event=0x86edde8, stream=0x4026c894)
at EditresCom.c:1429
#8 0x4026210b in ExecuteCommand (w=0x86fc158, sel=405, ident=2 '\002',
event=0x86edde8) at EditresCom.c:534
#9 0x4026200a in GetCommand (w=0x86fc158, data=0x2, selection=0xbfffdda0,
type=0xbfffdd70, value=0x86eddc8, length=0xbfffdd78, format=0xbfffdd74)
at EditresCom.c:461
#10 0x40296afa in HandleNormal (dpy=0x864f0b0, widget=0x86fc158, property=274,
info=0x87080a0, closure=0x2, selection=405) at Selection.c:1310
#11 0x40296df1 in HandleSelectionReplies (widget=0x86fc158, closure=0x87080a0,
ev=0xbfffdfc8, cont=0xbfffde0f "\001") at Selection.c:1408
#12 0x4028515b in CallEventHandlers (widget=0x86fc158, event=0xbfffdfc8,
mask=2147483648) at Event.c:841
#13 0x402853a2 in XtDispatchEventToWidget (widget=0x86fc158, event=0xbfffdfc8)
at Event.c:952
#14 0x40285c15 in _XtDefaultDispatcher (event=0xbfffdfc8) at Event.c:1417
#15 0x40285f5d in XtDispatchEvent (event=0xbfffdfc8) at Event.c:1497
#16 0x40290787 in XtAppProcessEvent (app=0x838d778, mask=1) at NextEvent.c:1407
#17 0x081e43b5 in emacs_Xt_next_event (emacs_event=0x86d4074)
at event-Xt.c:2725
Note that frame #4 has w=0, which explains the BadWindow error. The
code corresponding to frame #5 is:
if (XtIsWidget(child) && !(mapped_when_managed && XtIsManaged(child)))
{
XWindowAttributes attrs;
if (XGetWindowAttributes(XtDisplay(child), XtWindow(child), &attrs)
&& attrs.map_state != IsViewable)
return (False);
}
So, we appear to have a valid widget with no window. Which widget?
print *child
$2 = {core = {self = 0x87469a0, widget_class =
0x8253d80, parent = 0x86fd658,
xrm_name = 1486, being_destroyed = 0 '\000',
destroy_callbacks = 0x8712b10, constraints = 0x0, x = 0, y = 0,
width = 25, height = 12, border_width = 0, managed = 0 '\000',
sensitive = 1 '\001', ancestor_sensitive = 1 '\001', event_table =
0x0,
tm = {translations = 0x8746778, proc_table = 0x0, current_state = 0x0,
lastEventTime = 0}, accelerators = 0x0, border_pixel = 0,
border_pixmap = 2, popup_list = 0x0, num_popups = 0,
name = 0x8702cae "scrollbar_65539", screen = 0x86aadf0, colormap = 32,
window = 0, depth = 16, background_pixel = 52857, background_pixmap = 2,
visible = 1 '\001', mapped_when_managed = 1 '\001'}}
I.e. "scrollbar_65539".
There are two scrollbars; 65538 is the vertical one (width = 15,
height = 895), so 65539 must be the horizontal one. But the horizontal
one isn't displayed unless truncate-lines is t. Presumably it's being
created at startup but not realised until necessary.
Personally, I consider this to be a bug in libXmu; it ought to be
calling XtIsRealized() on the widget before trying to use its window.
Also, I'm not sure how much XEmacs can do about it, given that the
last XEmacs function in the backtrace is XtDispatchEvent().
OTOH, win light of both this and the SelectionRequest/BadWindow hangs,
I'm starting to suspect a flaw in the X error handler (OTOH, it
doesn't help that the "officially" correct behaviour for error
handlers involves terminating the application).
--
Glynn Clements <glynn.clements(a)virgin.net>