APPROVE COMMIT
NOTE: This patch has been committed.
src/ChangeLog addition:
2005-03-02 Aidan Kehoe <kehoea(a)parhasard.net>
* select-x.c (x_reply_selection_request): Check that
XtWindowToWidget returns NULL before calling XtRegisterDrawable,
document why.
XEmacs Trunk source patch:
Diff command: cvs -q diff -u
Files affected: src/select-x.c
Index: src/select-x.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/select-x.c,v
retrieving revision 1.22
diff -u -u -r1.22 select-x.c
--- src/select-x.c 2005/03/02 13:06:40 1.22
+++ src/select-x.c 2005/03/02 18:29:25
@@ -545,8 +545,24 @@
target window, rather, pass them to us. This would be a hack, but
the Xt selection routines are broken for our purposes--we can't
pass them callbacks from Lisp, for example. Let's call it a
- workaround. */
- XtRegisterDrawable(display, (Drawable)window, widget);
+ workaround.
+
+ The call to wait_for_property_change means we can break out of that
+ function, switch to another frame on the same display (which will
+ be another Xt widget), select a huge amount of text, and have the
+ same (foreign) app ask for another incremental selection
+ transfer. Programming like X11 made sense, would mean that, in that
+ case, XtRegisterDrawable is called twice with different widgets.
+
+ Since the results of calling XtRegisterDrawable when the drawable
+ is already registered with another widget are undefined, we want to
+ avoid that--so, only call it when XtWindowToWidget returns NULL,
+ which it will only do with a valid Window if it's not already
+ registered. */
+ if (NULL == XtWindowToWidget(display, window))
+ {
+ XtRegisterDrawable(display, (Drawable)window, widget);
+ }
prop_id = expect_property_change (display, window, reply.property,
PropertyDelete);
--
“I, for instance, am gung-ho about open source because my family is being
held hostage in Rob Malda’s basement. But who fact-checks me, or Enderle,
when we say something in public? No-one!” -- Danny O’Brien
Show replies by date