Index: /FCKeditor/branches/features/floating_dialog/editor/fckdialog.html
===================================================================
--- /FCKeditor/branches/features/floating_dialog/editor/fckdialog.html	(revision 1264)
+++ /FCKeditor/branches/features/floating_dialog/editor/fckdialog.html	(revision 1265)
@@ -515,4 +515,14 @@
 }() ;
 
+// readystatechange handler for registering drag and drop handlers in cover iframes, defined out here to avoid memory leak.
+// Do NOT put this function inside Main() as a private function as it will induce memory leak in IE and it's not detectable
+// with Drip or sIEve and undetectable leaks are really nasty (sigh).
+var onReadyRegister = function()
+{
+	if ( this.readyState != 'complete' )
+		return ;
+	DragAndDrop.RegisterHandlers( this.contentWindow ) ;
+}
+
 // The business logic of the dialog, dealing with operational things like dialog open/dialog close/enable/disable/etc.
 var Main = function()
@@ -521,16 +531,9 @@
 	if ( window.addEventListener )
 	{
+		// Keep a reference to the editor since Editor() doesn't work when the iframe is unloading.
 		var editorRef = Editor() ;
 		window.addEventListener( 'unload', function(){ editorRef.FCKFocusManager.Unlock() ; }, false ) ;
 	}
 
-
-	// readystatechange handler for registering drag and drop handlers in cover iframes, defined out here to avoid memory leak.
-	var onReadyRegister = function()
-	{
-		if ( this.readyState != 'complete' )
-			return ;
-		DragAndDrop.RegisterHandlers( this.contentWindow ) ;
-	}
 
 	var setOnKeyDown = function( targetDocument )
