Tk Source Code

View Ticket
Login
Ticket UUID: 3517228
Title: Endless loop inside Tk library
Type: Bug Version: obsolete: 8.5.10
Submitter: gcramer Created on: 2012-04-12 15:17:36
Subsystem: 56. [grab] Assigned To: hobbs
Priority: 5 Medium Severity:
Status: Open Last Modified: 2012-05-24 00:04:55
Resolution: None Closed By:
    Closed on:
Description:
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.
User Comments: gcramer added on 2012-05-24 00:04:55:
> 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.

stevenaaus added on 2012-05-23 17:19:00:
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. */
        }

gcramer added on 2012-04-12 22:17:41:

File Added - 440982: TkPointerEvent.patch.c

Attachments: