I a trying to setup a web page that fires up Nedit as a remote X app
using lbxproxy and xrx, using the sample .rx and .pl files that
came with xrx.

The effect of this is that Nedit/Lesstiff runs as an *untrusted*
client on the remote users display. Then 2 problems occur:

1) Nedit gets a bad window error with trying to read a property
   from the drag proxy window. This beats me, after all Nedit
   created that window itself, then how come it can't read the
   property from the window?

   Not that I care, I'm not using D&D anyway....

2) What matters to me is that Nedit bombs on the bad window!
   I have traced this down to two bugs:

2a) There is an off-by-one error in the error handler, when comparing
    the serial numbers of the error and the request. it uses ">" where
    ">=" (or even better circular ">=") was intented.

2b) Another begin_protection is required 50 requests later on.


The attached patch against lesstif-0.93.15 fixes problems 2a) and 2b).

Nedit now works with xrx!

--- DragBS.c.old        Fri Jul 27 20:51:55 2001
+++ DragBS.c    Wed Nov 28 03:33:38 2001
@@ -317,7 +317,7 @@
 
     if (event->error_code == BadWindow &&
        event->resourceid == errorWindow &&
-       event->serial > firstProtectRequest)
+       (event->serial-firstProtectRequest) >= 0 )
     {
        bad_window = True;
 
@@ -1786,6 +1786,7 @@
 
     pw = XmInternAtom(display, _XA_MOTIF_DRAG_PROXY_WINDOW, False);
 
+    begin_protection(display, win);
     if (XGetWindowProperty(display, win, pw, 0L, PROP_LENGTH,
                           False, AnyPropertyType,
                           &atype, &aformat, &nitems, &bafter, &prop)
@@ -1795,6 +1796,7 @@
                      __FILE__, __LINE__, bafter));
        win = *((Window *)prop);
     }
+    end_protection(display);
     if (prop)
     {
        XFree((XPointer)prop);

Reply via email to