Index: _source/plugins/editingblock/plugin.js
===================================================================
--- _source/plugins/editingblock/plugin.js	(revision 3677)
+++ _source/plugins/editingblock/plugin.js	Thu Jul 02 13:24:04 CST 2009
@@ -171,6 +171,7 @@
 
 			var currentMode = getMode( this );
 			data = currentMode.getData();
+			this.fire( 'beforeModeUnload' );
 			currentMode.unload( holderElement );
 			this.mode = '';
 		}
Index: _source/plugins/undo/plugin.js
===================================================================
--- _source/plugins/undo/plugin.js	(revision 3790)
+++ _source/plugins/undo/plugin.js	Thu Jul 02 13:27:50 CST 2009
@@ -81,24 +81,18 @@
 
 			} );
 
+			// Always save an undo snapshot - the previous mode might have
+			// changed editor contents.
+			editor.on( 'beforeModeUnload', function(){
+				editor.mode == 'wysiwyg' && undoManager.save( true );
+			} );
+
 			// Make the undo manager available only in wysiwyg mode.
 			editor.on( 'mode', function()
 				{
-					if ( editor.mode == 'wysiwyg' )
-					{
-						if ( !undoManager.enabled )
-						{
-							undoManager.enabled = true;
-							// Always save an undo snapshot - the previous mode might have changed
-							// editor contents.
-							undoManager.save( true );
-						}
-					}
-					else
-						undoManager.enabled = false;
-
+					undoManager.enabled = editor.mode == 'wysiwyg';
 					undoManager.onChange();
-				});
+				} );
 
 			editor.ui.addButton( 'Undo',
 				{
Index: CHANGES.html
===================================================================
--- CHANGES.html	(revision 3797)
+++ CHANGES.html	Thu Jul 02 13:31:16 CST 2009
@@ -88,6 +88,7 @@
 		<li><a href="http://dev.fckeditor.net/ticket/3825">#3825</a> : Fixed JS error when opening spellingcheck.</li>
 		<li><a href="http://dev.fckeditor.net/ticket/3862">#3862</a> : Fixed html parser infinite loop on certain malformed 
 			source code.</li>
+		<li><a href="http://dev.fckeditor.net/ticket/3871">#3871</a> : Unable to redo when undos to the front of snapshots stack.</li>
 	</ul>
 	<h3>
 		CKEditor 3.0 RC</h3>
