Subject: bug#7949: 24.0.50; GNU Emacs with Xaw3d does not launch as X client

From: Peter Dyballa <[email-masked]>
Date: Tue, 1 Feb 2011 19:02:31 +0100

Am 01.02.2011 um 08:20 schrieb Jan Djärv:

> % gdb emacs
> (gdb) b x_connection_closed
> (gdb) r -xrm '*synchronous: true'
> // error occurs
> (gdb) p error_message
> (gdb) bt

In xterm.c I moved " */" by few lines from #7568 to #7571:

   /* The display may have been closed before this function is called.
      Check if it is still open before calling XSync.  */
   if (x_display_info_for_display (x_error_message->dpy) != 0)
     XSync (x_error_message->dpy, False);

=>

   /* The display may have been closed before this function is called.
      Check if it is still open before calling XSync.
   if (x_display_info_for_display (x_error_message->dpy) != 0)
     XSync (x_error_message->dpy, False);
   */

Just commenting the XSync would produce an error. Then I reconfigured  
to compile with -O0. This binary now shows this behaviour:

Current directory is .../emacs-24.0.50/src/
GNU gdb 6.3.50-20050815 (Apple version gdb-967) (Tue Jul 14 02:15:14  
UTC 2009)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and  
you are
welcome to change it and/or distribute copies of it under certain  
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for  
details.
This GDB was configured as "powerpc-apple-darwin"...Reading symbols  
for shared libraries ........................... done

DISPLAY = :0
TERM = dumb
Breakpoint 1 at 0x7a58bc0
Breakpoint 2 at 0x19e468: file sysdep.c, line 836.
(gdb) b x_connection_closed
Breakpoint 3 at 0x12a198: file xterm.c, line 7688.
(gdb) r -xrm '*synchronous: true'
Starting program: .../emacs-24.0.50/src/emacs -xrm '*synchronous: true'
Reading symbols for shared libraries +++++++++++++++++++++++++ 
+ 
...............................................................................................warning 
: Could not find object file [for some bzr related things]

.. done
Breakpoint 1 at 0x9134abc0

Breakpoint 3, x_connection_closed (dpy=0x3034a00,  
error_message=0xbfffb258 "X protocol error: BadValue (integer  
parameter out of range for operation) on protocol request 45") at  
xterm.c:7689
(gdb) p error_message
$1 = 0xbfffb258 "X protocol error: BadValue (integer parameter out of  
range for operation) on protocol request 45"
(gdb) bt
#0  x_connection_closed (dpy=0x3034a00, error_message=0xbfffb258 "X  
protocol error: BadValue (integer parameter out of range for  
operation) on protocol request 45") at xterm.c:7689
#1  0x0012a780 in x_error_quitter (display=0x3034a00,  
error=0xbfffb468) at xterm.c:7862
#2  0x0012a6c0 in x_error_handler (display=0x3034a00,  
error=0xbfffb468) at xterm.c:7832
#3  0x00780b38 in _XError ()
#4  0x0077d2f8 in handle_error ()
#5  0x0077d5e4 in handle_response ()
#6  0x0077e0c0 in _XReply ()
#7  0x0075ab74 in _XQueryFont ()
#8  0x0075bdd8 in XLoadQueryFont ()
#9  0x0060e92c in XtCvtStringToFontStruct ()
#10 0x0060b958 in CallConverter ()
#11 0x0060bf2c in _XtConvert ()
#12 0x0062aa60 in GetResources ()
#13 0x0062b124 in _XtGetResources ()
#14 0x00611b14 in xtCreate ()
#15 0x006121cc in _XtCreateWidget ()
#16 0x00612288 in XtCreateWidget ()
#17 0x00309164 in xlw_create_menubar (instance=0x187fd00) at lwlib- 
Xlw.c:151
#18 0x003079d4 in instantiate_widget_instance (instance=0x187fd00)  
at .../emacs-24.0.50/lwlib/lwlib.c:814
#19 0x00306494 in allocate_widget_instance (info=0x186cfd0,  
parent=0x18568b0, pop_up_p=0 '\0') at .../emacs-24.0.50/lwlib/lwlib.c: 
308
#20 0x00307ba8 in lw_make_widget (id=1, parent=0x18568b0, pop_up_p=0  
'\0') at .../emacs-24.0.50/lwlib/lwlib.c:858
#21 0x00307c68 in lw_create_widget (type=0x316e70 "menubar",  
name=0x316e70 "menubar", id=1, val=0x185c960, parent=0x18568b0,  
pop_up_p=0 '\0', pre_activate_cb=0x7fd38 <popup_activate_callback>,  
selection_cb=0x7ff1c <menubar_selection_callback>,  
post_activate_cb=0x7fd90 <popup_deactivate_callback>,  
highlight_cb=0x7fe7c <menu_highlight_callback>) at .../emacs-24.0.50/ 
lwlib/lwlib.c:874
#22 0x00080fac in set_frame_menubar (f=0x184af10, first_time=1,  
deep_p=1) at xmenu.c:1213
#23 0x000811b4 in initialize_frame_menubar (f=0x184af10) at xmenu.c:1280
#24 0x0013b910 in Fx_create_frame (parms=21723694) at xfns.c:3415
#25 0x0024777c in Ffuncall (nargs=2, args=0xbfffdb00) at eval.c:2842
#26 0x002b3e94 in Fbyte_code (bytestr=3579993, vector=3580013,  
maxdepth=20) at bytecode.c:676
#27 0x00248464 in funcall_lambda (fun=3579957, nargs=1,  
arg_vector=0xbfffde84) at eval.c:3028
#28 0x00247b04 in Ffuncall (nargs=2, args=0xbfffde80) at eval.c:2891
#29 0x002b3e94 in Fbyte_code (bytestr=3917681, vector=3917701,  
maxdepth=24) at bytecode.c:676
#30 0x00248464 in funcall_lambda (fun=3917653, nargs=1,  
arg_vector=0xbfffe204) at eval.c:3028
#31 0x00247b04 in Ffuncall (nargs=2, args=0xbfffe200) at eval.c:2891
#32 0x002b3e94 in Fbyte_code (bytestr=3915017, vector=3915037,  
maxdepth=24) at bytecode.c:676
#33 0x00248464 in funcall_lambda (fun=3914989, nargs=0,  
arg_vector=0xbfffe584) at eval.c:3028
#34 0x00247b04 in Ffuncall (nargs=1, args=0xbfffe580) at eval.c:2891
#35 0x002b3e94 in Fbyte_code (bytestr=3617089, vector=3617109,  
maxdepth=28) at bytecode.c:676
#36 0x00248464 in funcall_lambda (fun=3617069, nargs=0,  
arg_vector=0xbfffe904) at eval.c:3028
#37 0x00247b04 in Ffuncall (nargs=1, args=0xbfffe900) at eval.c:2891
#38 0x002b3e94 in Fbyte_code (bytestr=3614513, vector=3614533,  
maxdepth=24) at bytecode.c:676
#39 0x00248464 in funcall_lambda (fun=3614493, nargs=0,  
arg_vector=0xbfffebf0) at eval.c:3028
#40 0x00247efc in apply_lambda (fun=3614493, args=41949218,  
eval_flag=1) at eval.c:2954
#41 0x00245ef4 in Feval (form=21720750) at eval.c:2296
#42 0x0017236c in top_level_2 () at keyboard.c:1138
#43 0x002435f8 in internal_condition_case (bfun=0x172338  
<top_level_2>, handlers=41977714, hfun=0x171c98 <cmd_error>) at eval.c: 
1408
#44 0x001723f4 in top_level_1 (ignore=41949218) at keyboard.c:1146
#45 0x00242d40 in internal_catch (tag=41975810, func=0x17238c  
<top_level_1>, arg=41949218) at eval.c:1152
#46 0x00172224 in command_loop () at keyboard.c:1101
#47 0x0017144c in recursive_edit_1 () at keyboard.c:731
#48 0x00171740 in Frecursive_edit () at keyboard.c:793
#49 0x0016ed48 in main (argc=3, argv=0xbffff7bc) at emacs.c:1682

Lisp Backtrace:
"x-create-frame" (0xbfffdb04)
"x-create-frame-with-faces" (0xbfffde84)
"make-frame" (0xbfffe204)
"frame-initialize" (0xbfffe584)
"command-line" (0xbfffe904)
"normal-top-level" (0xbfffebf0)
(gdb)

Line #7689 in xterm.c is the dpyinfo declaration:

static SIGTYPE
x_connection_closed (Display *dpy, const char *error_message)
{
   struct x_display_info *dpyinfo = x_display_info_for_display (dpy);
   Lisp_Object frame, tail;
   int index = SPECPDL_INDEX ();

   error_msg = (char *) alloca (strlen (error_message) + 1);
   strcpy (error_msg, error_message);
   handling_signal = 0;

   /* Prevent being called recursively because of an error condition
      below.  Otherwise, we might end up with printing ``can't find per
      display information'' in the recursive call instead of printing
      the original message here.  */
   x_catch_errors (dpy);

--
Greetings

   Pete

Reisen bildet - vor allem Staus auf Autobahnen.
				(Michael Schiff)