Menu

#2960 Endless loop inside Tk library

obsolete: 8.5.10
open
56. [grab] (17)
5
2012-04-12
2012-04-12
No

I have the following case:
1. Mapping a modal window (with local grab)
2. Mapping a subwindow of the modal window
3. Mouse click into the subwindow
The result is a frozen screen. With debugging I discovered that an endless call of function TkPointerEvent() is freezing the screen. I made a patch to this function (see attached file; possibly a better patch is required) and my application is working. Unfortunately I couldn't build a simple test application with the same behavior.

Discussion

  • Gregor Cramer

    Gregor Cramer - 2012-04-12

    Patch of function TkPointerEvent()

     
  • Steven

    Steven - 2012-05-23

    I suppose the "subwindow of the modal window" is a toplevel ?
    In this case, it sounds like a bug, but i wonder if you're abusing grab. Grab's man page says to use with care.

    This is your diff

    --- /root/1 2012-05-23 20:16:39.000000000 +0000
    +++ /root/new/TkPointerEvent.patch.c 2012-05-23 20:12:42.000000000 +0000
    @@ -192,7 +192,17 @@
    }
    }
    if (winPtr2 != winPtr) {
    +/********** FIX of endless loop *********************************/
    + if (eventPtr->xbutton.send_event == True) {
    + /* already redirected */
    + return 1;
    + }
    +/********** END fix of endless loop *****************************/
    TkChangeEventWindow(eventPtr, winPtr2);
    +/********** FIX of endless loop *********************************/
    + /* mark as redirected to avoid endless calls of this function */
    + eventPtr->xbutton.send_event = True;
    +/********** END fix of endless loop *****************************/
    Tk_QueueWindowEvent(eventPtr, TCL_QUEUE_HEAD);
    return 0; /* Note 3. */
    }

     
  • Gregor Cramer

    Gregor Cramer - 2012-05-23

    > I suppose the "subwindow of the modal window" is a toplevel ?
    Yes.

    > but i wonder if you're abusing grab. Grab's man page says to use with care.
    I don not abuse grabs, the file selection dialog (the parent toplevel) has to be modal (local modality), and the child toplevel is the help dialog.

     
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.