summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2004-07-11 22:32:47 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2004-07-11 22:32:47 (GMT)
commite129e16ea94596f51c3fa0cc54c39f611360d2bc (patch)
treed37ff05a7c72b19929150cf9e6acfbd0690c211a
parent8a5fab122f10d4947b2c34057abc78f925299c9b (diff)
downloadtk-e129e16ea94596f51c3fa0cc54c39f611360d2bc.zip
tk-e129e16ea94596f51c3fa0cc54c39f611360d2bc.tar.gz
tk-e129e16ea94596f51c3fa0cc54c39f611360d2bc.tar.bz2
Users can cause Unix file dialog to vanish early; treat like Cancel [Bug 987169]
-rw-r--r--ChangeLog5
-rw-r--r--library/tkfbox.tcl14
2 files changed, 18 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index f2e10e5..40dc4b8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2004-07-11 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * library/tkfbox.tcl (::tk::dialog::file::Create): Watch out for
+ users destroying the dialog indirectly. [Bug 987169]
+
2004-06-29 Jeff Hobbs <jeffh@ActiveState.com>
* generic/tkCmds.c (Tk_WinfoObjCmd): refetch interp result obj for
diff --git a/library/tkfbox.tcl b/library/tkfbox.tcl
index cc99e86..5d4fcb9 100644
--- a/library/tkfbox.tcl
+++ b/library/tkfbox.tcl
@@ -11,7 +11,7 @@
# files by clicking on the file icons or by entering a filename
# in the "Filename:" entry.
#
-# RCS: @(#) $Id: tkfbox.tcl,v 1.38.2.3 2003/11/12 00:04:32 hobbs Exp $
+# RCS: @(#) $Id: tkfbox.tcl,v 1.38.2.4 2004/07/11 22:32:47 dkf Exp $
#
# Copyright (c) 1994-1998 Sun Microsystems, Inc.
#
@@ -1082,6 +1082,7 @@ static char updir_bits[] = {
# is in the right order
set data(okBtn) [::tk::AmpWidget button $f2.ok \
-text "[mc "&OK"]" -default active -pady 3]
+ bind $data(okBtn) <Destroy> [list ::tk::dialog::file::Destroyed $w]
set data(cancelBtn) [::tk::AmpWidget button $f2.cancel \
-text "[mc "&Cancel"]" -default normal -pady 3]
@@ -1656,6 +1657,16 @@ proc ::tk::dialog::file::CancelCmd {w} {
upvar ::tk::dialog::file::[winfo name $w] data
variable ::tk::Priv
+ $data(okBtn) configure <Destroy> {}
+ set Priv(selectFilePath) ""
+}
+
+# Gets called when user destroys the dialog directly [Bug 987169]
+#
+proc ::tk::dialog::file::Destroyed {w} {
+ upvar ::tk::dialog::file::[winfo name $w] data
+ variable ::tk::Priv
+
set Priv(selectFilePath) ""
}
@@ -1777,5 +1788,6 @@ proc ::tk::dialog::file::Done {w {selectFilePath ""}} {
}
}
}
+ $data(okBtn) configure <Destroy> {}
set Priv(selectFilePath) $selectFilePath
}