From: sls Date: Wed, 21 Jun 1995 21:54:31 +0000 (+0000) Subject: (get_class): check to make sure window still exists. X-Git-Tag: r_5_1_4~24 X-Git-Url: https://privyetmir.co.uk/gitweb.cgi?a=commitdiff_plain;h=41bcfa66e0633a8967063090b4811d93d286208f;p=tkinspect (get_class): check to make sure window still exists. --- diff --git a/windows_info.tcl b/windows_info.tcl index f005d77..64b02ae 100644 --- a/windows_info.tcl +++ b/windows_info.tcl @@ -38,6 +38,14 @@ object_class windows_info { } method get_class {target w} { if ![info exists slot($w.class)] { + if ![send $target winfo exists $w] { + # the window no longer exists, so delete it from our list + set ndx [lsearch -exact $slot(windows) $w] + if {$ndx >= 0} { + set slot(windows) [lreplace $slot(windows) $ndx $ndx] + } + return "" + } set slot($w.class) [send $target [list winfo class $w]] } return $slot($w.class)