summaryrefslogtreecommitdiffstats
path: root/win/tkWinDialog.c
diff options
context:
space:
mode:
authorashok <ashok>2014-12-03 16:33:49 (GMT)
committerashok <ashok>2014-12-03 16:33:49 (GMT)
commita59d256b75d74edc1e878bf776e394636df0a422 (patch)
tree7d039ec15045c8571b702275696a1bb75298e2c1 /win/tkWinDialog.c
parent0da68cf7b3a0be2417f220ce6a09711934774b76 (diff)
downloadtk-a59d256b75d74edc1e878bf776e394636df0a422.zip
tk-a59d256b75d74edc1e878bf776e394636df0a422.tar.gz
tk-a59d256b75d74edc1e878bf776e394636df0a422.tar.bz2
Fix for 4a0451f529. Needed a Tcl_ResetResult after recursive event
loop otherwise clicking Cancel would return a non-empty result in case a script was run in the background as part of the event loop. Also updated test suite which did not actually check that a Cancel resulted in an empty event string.
Diffstat (limited to 'win/tkWinDialog.c')
-rw-r--r--win/tkWinDialog.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c
index adb5e9e..c137111 100644
--- a/win/tkWinDialog.c
+++ b/win/tkWinDialog.c
@@ -1407,6 +1407,21 @@ static int GetFileNameVista(Tcl_Interp *interp, OFNOpts *optsPtr,
hr = fdlgIf->lpVtbl->Show(fdlgIf, hWnd);
Tcl_SetServiceMode(oldMode);
+ /*
+ * Ensure that hWnd is enabled, because it can happen that we have updated
+ * the wrapper of the parent, which causes us to leave this child disabled
+ * (Windows loses sync).
+ */
+
+ if (hWnd)
+ EnableWindow(hWnd, 1);
+
+ /*
+ * Clear interp result since it might have been set during the modal loop.
+ * http://core.tcl.tk/tk/tktview/4a0451f5291b3c9168cc560747dae9264e1d2ef6
+ */
+ Tcl_ResetResult(interp);
+
if (SUCCEEDED(hr)) {
if ((oper == OFN_FILE_OPEN) && optsPtr->multi) {
IShellItemArray *multiIf;