Tk Source Code

View Ticket
Login
Ticket UUID: 2009788
Title: wm forget crashes on windows
Type: Bug Version: obsolete: 8.5.3
Submitter: mrohr Created on: 2008-07-03 14:59:36
Subsystem: 68. Win Window Operations Assigned To: hobbs
Priority: 9 Immediate Severity:
Status: Closed Last Modified: 2008-07-26 20:05:18
Resolution: Fixed Closed By: patthoyts
    Closed on: 2008-07-26 13:05:18
Description:
The following script crashes wish on windows:

    toplevel .d1
    #update
    wm forget .d1

Note that it does not crash when run interactively or when 'update' is uncommented. I tried it with ActiveTcl 8.5.2 and etcl-1.0-rc29 (8.5.3).
User Comments: patthoyts added on 2008-07-26 19:29:08:
Logged In: YES 
user_id=202636
Originator: NO

Crash is in Tk_GetHWND(Window window) where window is 0.
This is called from WmForgetCmd as a parameter to RemapWindows() but winPtr->parentPtr->window is 0.
So the problem is trying to forget a toplevel before its _parent_ is mapped.
A test that demonstrates this is:
test wm-forget-1.1 "bug #2009788: forget toplevel can cause crash" -setup {
} -body {
    toplevel .parent
    toplevel .parent.child
    wm forget .parent.child
} -cleanup {
    deleteWindows
}  -result {}