Index: /FCKeditor/trunk/_whatsnew.html
===================================================================
--- /FCKeditor/trunk/_whatsnew.html	(revision 17)
+++ /FCKeditor/trunk/_whatsnew.html	(revision 18)
@@ -132,5 +132,6 @@
 		<li>[<a target="_blank" href="https://sourceforge.net/tracker/index.php?func=detail&aid=1577247&group_id=75348&atid=543653">SF
 			BUG-1577247</a>] Unneeded call to captureEvents and releaseEvents.</li>
-	</ul>
+		<li>[<a target="_blank" href="https://sourceforge.net/tracker/?func=detail&atid=543653&aid=1610790&group_id=75348">SF BUG-1610790</a>] On some specific situations, the call to form.submit(), in form were FCKeditor has
+			been unloaded by code, was throwing the "Can't execute code from a freed script" error.</li></ul>
 	<h3>
 		Version 2.3.2</h3>
Index: /FCKeditor/trunk/editor/_source/commandclasses/fck_othercommands.js
===================================================================
--- /FCKeditor/trunk/editor/_source/commandclasses/fck_othercommands.js	(revision 17)
+++ /FCKeditor/trunk/editor/_source/commandclasses/fck_othercommands.js	(revision 18)
@@ -142,5 +142,5 @@
 {
 	// Get the linked field form.
-	var oForm = FCK.LinkedField.form ;
+	var oForm = FCK.GetParentForm() ;
 
 	if ( typeof( oForm.onsubmit ) == 'function' )
Index: /FCKeditor/trunk/editor/_source/fckeditorapi.js
===================================================================
--- /FCKeditor/trunk/editor/_source/fckeditorapi.js	(revision 17)
+++ /FCKeditor/trunk/editor/_source/fckeditorapi.js	(revision 18)
@@ -28,4 +28,15 @@
 				'{' +
 					'return this.__Instances[ name ];' +
+				'},' +
+				
+				'_FormSubmit : function()' +
+				'{' +
+					'for ( var name in FCKeditorAPI.__Instances )' +
+					'{' +
+						'var oEditor = FCKeditorAPI.__Instances[ name ] ;' +
+						'if ( oEditor.GetParentForm() == this )' +
+							'oEditor.UpdateLinkedField() ;' +
+					'}' +
+					'this._FCKOriginalSubmit() ;' +
 				'},' +
 				
@@ -101,4 +112,27 @@
 }
 
+// Attach to the form onsubmit event and to the form.submit().
+function _AttachFormSubmitToAPI()
+{
+	// Get the linked field form.
+	var oForm = FCK.GetParentForm() ;
+	
+	if ( oForm )
+	{
+		// Attach to the onsubmit event.
+		FCKTools.AddEventListener( oForm, 'submit', FCK.UpdateLinkedField ) ;
+		
+		// IE sees oForm.submit function as an 'object'.
+		if ( !oForm._FCKOriginalSubmit && ( typeof( oForm.submit ) == 'function' || ( !oForm.submit.tagName && !oForm.submit.length ) ) )
+		{
+			// Save the original submit.
+			oForm._FCKOriginalSubmit = oForm.submit ;
+			
+			// Create our replacement for the submit.
+			oForm.submit = FCKeditorAPI._FormSubmit ;
+		}
+	}	
+}
+
 function FCKeditorAPI_Cleanup()
 {
Index: /FCKeditor/trunk/editor/_source/internals/fck.js
===================================================================
--- /FCKeditor/trunk/editor/_source/internals/fck.js	(revision 17)
+++ /FCKeditor/trunk/editor/_source/internals/fck.js	(revision 18)
@@ -7,12 +7,25 @@
 */
 
-// FCK represents the active editor instance
-var FCK = new Object() ;
-FCK.Name			= FCKURLParams[ 'InstanceName' ] ;
+// FCK represents the active editor instance.
+var FCK = 
+{
+	Name		: FCKURLParams[ 'InstanceName' ],
+	Status		: FCK_STATUS_NOTLOADED,
+	EditMode	: FCK_EDITMODE_WYSIWYG,
+	
+	GetLinkedFieldValue : function()
+	{
+		return this.LinkedField.value ;
+	},
+	
+	GetParentForm : function()
+	{
+		return this.LinkedField.form ;
+	}
+} ;
 
-FCK.Status			= FCK_STATUS_NOTLOADED ;
-FCK.EditMode		= FCK_EDITMODE_WYSIWYG ;
-
-FCK.LoadLinkedFile = function()
+// Set the FCK.LinkedField reference to the field that will be used to post the
+// editor data.
+(function()
 {
 	// There is a bug on IE... getElementById returns any META tag that has the
@@ -24,42 +37,44 @@
 	var oDocument = window.parent.document ;
 
-	var eLinkedField		= oDocument.getElementById( FCK.Name ) ;
-	var colElementsByName	= oDocument.getElementsByName( FCK.Name ) ;
+	// Try to get the field using the ID.
+	var eLinkedField = oDocument.getElementById( FCK.Name ) ;
 
 	var i = 0;
 	while ( eLinkedField || i == 0 )
 	{
-		if ( eLinkedField && ( eLinkedField.tagName.toLowerCase() == 'input' || eLinkedField.tagName.toLowerCase() == 'textarea' ) )
+		if ( eLinkedField && eLinkedField.tagName.toLowerCase().Equals( 'input', 'textarea' ) )
 		{
 			FCK.LinkedField = eLinkedField ;
 			break ;
 		}
-		eLinkedField = colElementsByName[i++] ;
+
+		eLinkedField = oDocument.getElementsByName( FCK.Name )[i++] ;
 	}
-}
-FCK.LoadLinkedFile() ;
+})() ;
 
-var FCKTempBin = new Object() ;
-FCKTempBin.Elements = new Array() ;
+var FCKTempBin = 
+{
+	Elements : new Array(),
 
-FCKTempBin.AddElement = function( element )
-{
-	var iIndex = this.Elements.length ;
-	this.Elements[ iIndex ] = element ;
-	return iIndex ;
-}
+	AddElement : function( element )
+	{
+		var iIndex = this.Elements.length ;
+		this.Elements[ iIndex ] = element ;
+		return iIndex ;
+	},
 
-FCKTempBin.RemoveElement = function( index )
-{
-	var e = this.Elements[ index ] ;
-	this.Elements[ index ] = null ;
-	return e ;
-}
+	RemoveElement : function( index )
+	{
+		var e = this.Elements[ index ] ;
+		this.Elements[ index ] = null ;
+		return e ;
+	},
 
-FCKTempBin.Reset = function()
-{
-	var i = 0 ;
-	while ( i < this.Elements.length )
-		this.Elements[ i++ ] == null ;
-	this.Elements.length = 0 ;
-}
+	Reset : function()
+	{
+		var i = 0 ;
+		while ( i < this.Elements.length )
+			this.Elements[ i++ ] == null ;
+		this.Elements.length = 0 ;
+	}
+} ;
Index: /FCKeditor/trunk/editor/_source/internals/fck_1.js
===================================================================
--- /FCKeditor/trunk/editor/_source/internals/fck_1.js	(revision 17)
+++ /FCKeditor/trunk/editor/_source/internals/fck_1.js	(revision 18)
@@ -15,5 +15,5 @@
 FCK.StartEditor = function()
 {
-	FCK.TempBaseTag = FCKConfig.BaseHref.length > 0 ? '<base href="' + FCKConfig.BaseHref + '" _fcktemp="true"></base>' : '' ;
+	this.TempBaseTag = FCKConfig.BaseHref.length > 0 ? '<base href="' + FCKConfig.BaseHref + '" _fcktemp="true"></base>' : '' ;
 
 	// Setup the keystroke handler.
@@ -36,9 +36,9 @@
 	}
 
-	FCK.EditingArea = new FCKEditingArea( document.getElementById( 'xEditingArea' ) ) ;
-	FCK.EditingArea.FFSpellChecker = false ;
+	this.EditingArea = new FCKEditingArea( document.getElementById( 'xEditingArea' ) ) ;
+	this.EditingArea.FFSpellChecker = false ;
 
 	// Set the editor's startup contents
-	this.SetHTML( FCKTools.GetLinkedFieldValue() ) ;
+	this.SetHTML( this.GetLinkedFieldValue() ) ;
 }
 
@@ -359,8 +359,5 @@
 	// Save the startup value for the "IsDirty()" check.
 	FCK.ResetIsDirty() ;
-
-	// Attach the editor to the form onsubmit event
-	FCKTools.AttachToLinkedFieldFormSubmit( FCK.UpdateLinkedField ) ;
-
+	
 	FCK.SetStatus( FCK_STATUS_ACTIVE ) ;
 }
Index: /FCKeditor/trunk/editor/_source/internals/fcktools.js
===================================================================
--- /FCKeditor/trunk/editor/_source/internals/fcktools.js	(revision 17)
+++ /FCKeditor/trunk/editor/_source/internals/fcktools.js	(revision 18)
@@ -27,71 +27,4 @@
 			this._AppendStyleSheet( documentElement, cssFileUrlOrArray[i] ) ;
 	}
-}
-
-/**
- * Gets the value of the hidden INPUT element that is associated to the editor.
- * This element has its ID set to the editor's instance name so the user refers
- * to the instance name when getting the posted data.
- */
-FCKTools.GetLinkedFieldValue = function()
-{
-	return FCK.LinkedField.value ;
-}
-
-/**
- * Attachs a function call to the submit event of the linked field form. This
- * function us generally used to update the linked field value before
- * submitting the form.
- */
-FCKTools.AttachToLinkedFieldFormSubmit = function( functionPointer )
-{
-	// Gets the linked field form
-	var oForm = FCK.LinkedField.form ;
-	
-	// Return now if no form is available
-	if (!oForm) return ;
-
-	// Attaches the functionPointer call to the onsubmit event
-	if ( FCKBrowserInfo.IsIE )
-		oForm.attachEvent( "onsubmit", functionPointer ) ;
-	else
-		oForm.addEventListener( 'submit', functionPointer, false ) ;
-	
-	//**
-	// Attaches the functionPointer call to the submit method 
-	// This is done because IE doesn't fire onsubmit when the submit method is called
-	// BEGIN --
-	
-	// Creates a Array in the form object that will hold all Attached function call
-	// (in the case there are more than one editor in the same page)
-	if (! oForm.updateFCKeditor) oForm.updateFCKeditor = new Array() ;
-	
-	// Adds the function pointer to the array of functions to call when "submit" is called
-	oForm.updateFCKeditor[oForm.updateFCKeditor.length] = functionPointer ;
-
-	// Switches the original submit method with a new one that first call all functions
-	// on the above array and the call the original submit
-	// IE sees it oForm.submit function as an 'object'.
-	if (! oForm.originalSubmit && ( typeof( oForm.submit ) == 'function' || ( !oForm.submit.tagName && !oForm.submit.length ) ) )
-	{
-		// Creates a copy of the original submit
-		oForm.originalSubmit = oForm.submit ;
-		
-		// Creates our replacement for the submit
-		oForm.submit = FCKTools_SubmitReplacer ;
-	}
-	// END --
-}
-
-function FCKTools_SubmitReplacer()
-{
-	if (this.updateFCKeditor)
-	{
-		// Calls all functions in the functions array
-		for (var i = 0 ; i < this.updateFCKeditor.length ; i++)
-			this.updateFCKeditor[i]() ;
-	}
-	// Calls the original "submit"
-	this.originalSubmit() ;
 }
 
Index: /FCKeditor/trunk/editor/fckeditor.html
===================================================================
--- /FCKeditor/trunk/editor/fckeditor.html	(revision 17)
+++ /FCKeditor/trunk/editor/fckeditor.html	(revision 18)
@@ -234,4 +234,6 @@
 		if ( FCKBrowserInfo.IsGecko )
 			FCKTools.RunFunction( window.onresize ) ;
+
+		_AttachFormSubmitToAPI() ;
 
 		FCK.SetStatus( FCK_STATUS_COMPLETE ) ;
