From 41bcfa66e0633a8967063090b4811d93d286208f Mon Sep 17 00:00:00 2001 From: sls Date: Wed, 21 Jun 1995 21:54:31 +0000 Subject: [PATCH] (get_class): check to make sure window still exists. --- windows_info.tcl | 8 ++++++++ 1 file changed, 8 insertions(+) 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) -- 2.23.0