updated for version 7.4.446
Problem:    In some situations, when setting up an environment to trigger an
            autocommand, the environment is not properly restored.
Solution:   Check the return value of switch_win() and call restore_win()
            always.  (Daniel Hahler)
diff --git a/src/window.c b/src/window.c
index 5012427..0088e32 100644
--- a/src/window.c
+++ b/src/window.c
@@ -1271,7 +1271,7 @@
 }
 
 /*
- * Initialize window "newp" from window"old".
+ * Initialize window "newp" from window "old".
  * Only the essential things are copied.
  */
     static void
@@ -6662,8 +6662,8 @@
 	|| defined(PROTO)
 /*
  * Set "win" to be the curwin and "tp" to be the current tab page.
- * restore_win() MUST be called to undo.
- * No autocommands will be executed.
+ * restore_win() MUST be called to undo, also when FAIL is returned.
+ * No autocommands will be executed until restore_win() is called.
  * When "no_display" is TRUE the display won't be affected, no redraw is
  * triggered, another tabpage access is limited.
  * Returns FAIL if switching to "win" failed.
@@ -6696,12 +6696,7 @@
 	    goto_tabpage_tp(tp, FALSE, FALSE);
     }
     if (!win_valid(win))
-    {
-# ifdef FEAT_AUTOCMD
-	unblock_autocmds();
-# endif
 	return FAIL;
-    }
     curwin = win;
     curbuf = curwin->w_buffer;
 # endif