Pete Ware <ware(a)cis.ohio-state.edu> writes:
> Gunnar Evermann <Gunnar.Evermann(a)nats.informatik.uni-hamburg.de> writes:
> 
> >  #else
> >    XtDestroyWidget (w);
> > +  XFlush (XtDisplay(w));   /* make sure the windows are really gone! */
> >  #endif /* EXTERNAL_WIDGET */
> 
> 
> XtDestroyWidget() does not actually destroy the window.  As I
> remember, it marks the widget (and all children) as in the process of
> being destroyed and puts it on a to-be-deleted list.  When the
> application returns to the main loop and all pending events are
> handled, then the widget is actually deleted (phase 2).  Destroying
> the actual window is one of the last things done in phase 2.
> 
> --pete
Didier Verna <verna(a)inf.enst.fr> writes:
> Gunnar Evermann <Gunnar.Evermann(a)nats.informatik.uni-hamburg.de> writes:
> 
> > I'm still not convinced that it is a bug in the Xlib. Is
> > XtDestroyWidgent() supposed to be synchronous?
> 
> 	yes.
Didier, new question: what do you mean by synchronous?
OK, I'm about ready to give about! :-) Apparently this patch is also
flawed. After reading Pete's mail and rereading the man page. I
thought: Oh, so I can crash my XEmacs now if I kill a frame from a
callback. and indeed I can:
C-x 5 2 & click on the 'close'-gadget in the upper left corner...
 262     kill (getpid (), fatal_error_code);
(dbx) where  
  [1] _kill(0x0, 0xa, 0x0, 0x0, 0x6f82227c, 0xc3bdc), at 0x6f8072e0
=>[2] fatal_error_signal(sig = 10), line 262 in "emacs.c"
  ---- called from signal handler with signal 10 (SIGBUS) ------
  [3] CallGetValuesHook(), at 0x6fb82478
  [4] CallGetValuesHook(0xb2fc00, 0x7df600, 0xefffe694, 0x1, 0x6fbc3c90, 0x6fbc3c8c), at 0x6fb82420
<snip another 75 CallGetValuesHook stackframes >
c3c8c), at 0x6fb82420
  [79] CallGetValuesHook(0x7dfa00, 0x7df600, 0xefffe694, 0x1, 0x6fbc3c90, 0x6fbc3c8c), at 0x6fb82420
  [80] XtGetValues(0x7df600, 0xefffe694, 0x1, 0x6fbc3c90, 0x6fbc3c8c, 0xffffffff), at 0x6fb827cc
  [81] x_set_frame_text_value(f = 0xb74000, value = 0xb4e200 "[21.0 "Finnish Landrace" XEmacs Lucid]: *scratch*", Xt_resource_name = 0x42dfe4 "title", Xt_resource_encoding_name = 0x42dfec "titleEncoding"), line 657 in "frame-x.c"
  [82] x_set_title_from_bufbyte(f = 0xb74000, name = 0xb4e200 "[21.0 "Finnish Landrace" XEmacs Lucid]: *scratch*"), line 670 in "frame-x.c"
  [83] update_frame_title(f = 0xb74000), line 2972 in "frame.c"
  [84] redisplay_frame(f = 0xb74000, preemption_check = 0), line 5425 in "redisplay.c"
  [85] redisplay_device(d = 0x5efe00), line 5498 in "redisplay.c"
  [86] redisplay_without_hooks(), line 5614 in "redisplay.c"
  [87] redisplay(), line 5682 in "redisplay.c"
  [88] Fnext_event(event = 11873420, prompt = 4628484), line 2238 in "event-stream.c"
  [89] Fcommand_loop_1(), line 570 in "cmdloop.c"
<snip rest of bt>
Ah, that's why XtDestroyWidget() needs two phases...
I guess through my patch I now have triggered the second one a bit two 
early. :-(
So, can somebody tell me where to Flush/Sync? 
 Gunnar