Menu

#127 Drag & Drop application die

open
nobody
None
5
2006-05-13
2006-05-13
iwahashi
No

An Drag & Drop application die after a window which
under a token is closed.

We could make the same situation by doing as follows
procedure.
1. Execute blt2.4z/demos/dragdrop2.tcl
2. Open another terminal(I should say a emulator
window or a console window ). Execute sleep &
exit command to close the terminal after 5sec.

% sleep 5;exit

3. Drag a token on the terminal and wait the
terminal is closed
4. Drag or drop the token after the terminal was
closed .
5. Then dragdrop2.tcl die. Error message is as
follows
-----------------------------------------------------
X Error of failed request: BadWindow (invalid Window
parameter)
Major opcode of failed request: 20 (X_GetProperty)
Resource id in failed request: 0x7000036
Serial number of failed request: 5055
Current serial number in output stream: 5055
-----------------------------------------------------

# Sorry my poor English.

Discussion

  • iwahashi

    iwahashi - 2006-05-13

    Logged In: YES
    user_id=1435853

    The error occur on

    Solaris8 / Linux
     Tcl/Tk8.4.4
     BLT2.4z-patch-2

     
  • kouritsu

    kouritsu - 2006-12-27

    Logged In: YES
    user_id=1676667
    Originator: NO

    a patch for the following file
    blt2.4z/src/bltDragdrop.c

    = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
    --- bltDragdrop.c.org 2004-01-06 09:03:13.000000000 +0900
    +++ bltDragdrop.c 2006-12-27 10:19:01.000000000 +0900
    @@ -703,9 +703,20 @@
    Window *childArr;
    unsigned int nChildren;
    Window dummy;
    + Tk_ErrorHandler handler;
    + int any = -1;
    + Status status;

    chainPtr = NULL;
    - if ((XQueryTree(display, window, &dummy, &dummy, &childArr, &nChildren)) &&
    + /*
    + * Ignore X errors (e.g., the window might not exist).
    + */
    + handler = Tk_CreateErrorHandler(display, any, any, any,
    + (Tk_ErrorProc *) NULL, (ClientData) NULL);
    + status = XQueryTree(display, window, &dummy, &dummy, &childArr, &nChildren);
    + Tk_DeleteErrorHandler(handler);
    + if ((status != 0) &&
    +// if ((XQueryTree(display, window, &dummy, &dummy, &childArr, &nChildren)) &&
    (nChildren > 0)) {
    register int i;

    @@ -733,14 +744,22 @@
    int result, actualFormat;
    Atom actualType;
    unsigned long nItems, bytesAfter;
    + Tk_ErrorHandler handler;
    + int any = -1;

    if (window == None) {
    return NULL;
    }
    data = NULL;
    + /*
    + * Ignore X errors (e.g., the window might not exist).
    + */
    + handler = Tk_CreateErrorHandler(display, any, any, any,
    + (Tk_ErrorProc *) NULL, (ClientData) NULL);
    result = XGetWindowProperty(display, window, dndAtom, 0, MAX_PROP_SIZE,
    False, XA_STRING, &actualType, &actualFormat, &nItems, &bytesAfter,
    (unsigned char **)&data);
    + Tk_DeleteErrorHandler(handler);
    if ((result != Success) || (actualFormat != 8) ||
    (actualType != XA_STRING)) {
    if (data != NULL) {
    @@ -767,14 +786,25 @@
    int *x1Ptr, *y1Ptr, *x2Ptr, *y2Ptr;
    {
    XWindowAttributes winAttrs;
    + Tk_ErrorHandler handler;
    + int any = -1;
    + int result = 0 ;

    + /*
    + * Ignore X errors (e.g., the window might not exist).
    + */
    + handler = Tk_CreateErrorHandler(display, any, any, any,
    + (Tk_ErrorProc *) NULL, (ClientData) NULL);
    if (XGetWindowAttributes(display, window, &winAttrs)) {
    *x1Ptr = winAttrs.x;
    *y1Ptr = winAttrs.y;
    *x2Ptr = winAttrs.x + winAttrs.width - 1;
    *y2Ptr = winAttrs.y + winAttrs.height - 1;
    + result = ( winAttrs.map_state == IsViewable ) ;
    }
    - return (winAttrs.map_state == IsViewable);
    + Tk_DeleteErrorHandler(handler);
    + return result ;
    + //return (winAttrs.map_state == IsViewable);
    }

    #endif /* WIN32 */
    = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.