﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
9763	Exception from editor after it is destroyed	Martin Häcker		"I've got the peculiar situation that in a very ajax heavy app sometimes I have to get rid of editors almost immediately after it has been added to the dom.

This works fine in most circumstances by calling editor.destroy() before removing the dom element that hosts it.

However If this happens on the first editor that is created, I always get an error out of core/editor.js:291 from onConfigLoad which still gets a callback after the configuration has loaded.

I'm not sure what the right fix is, as destroy() already seems to deregister the editor from all further events (though it doesn't catch this one).

This patch helped me work around the issue for now - but it is something that should be included in CKEditor I believe.

{{{

diff --git a/vendor/ckeditor-4.0/core/editor.js b/vendor/ckeditor-4.0/core/editor.js
index 2f31d13..5578ec1 100644
--- a/vendor/ckeditor-4.0/core/editor.js
+++ b/vendor/ckeditor-4.0/core/editor.js
@@ -280,6 +280,8 @@
        // ##### END: Config Privates
 
        function onConfigLoaded( editor ) {
+               if ( ! editor.element) return;
+               
                // Set config related properties.
                /**
                 * Indicates the read-only state of this editor. This is a read-only property.
}}}

To reproduce it you would use something along the lines of this
{{{
var holder = $('<div><div id=editor>')
editor = CKEDITOR.replace(holder.find('#editor'))
editor.destroy()
// wait for the config to have loaded
}}}"	Bug	closed	Normal		General		invalid		
