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)
commit9ec55a369e6054fd54ad66e75ce57ff65c467d24 (patch)
tree7d039ec15045c8571b702275696a1bb75298e2c1 /win/tkWinDialog.c
parent0f8874c514bb3c448a4f007df3262774df8a0252 (diff)
downloadtk-9ec55a369e6054fd54ad66e75ce57ff65c467d24.zip
tk-9ec55a369e6054fd54ad66e75ce57ff65c467d24.tar.gz
tk-9ec55a369e6054fd54ad66e75ce57ff65c467d24.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;