From 05cfaa6b842396d029d15c73925357e110f0777d Mon Sep 17 00:00:00 2001
From: gnaegi <none@none>
Date: Thu, 10 Oct 2013 10:25:32 +0200
Subject: [PATCH] OO-816 fix wrong usage of periodic executor, was never
 stopped and caused o2c=1 side effects randomly when a tiny editor was
 displayed

---
 .../commons/editor/htmleditor/_content/htmleditor.html     | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/olat/core/commons/editor/htmleditor/_content/htmleditor.html b/src/main/java/org/olat/core/commons/editor/htmleditor/_content/htmleditor.html
index df17e3ea385..ebbdcaa2219 100644
--- a/src/main/java/org/olat/core/commons/editor/htmleditor/_content/htmleditor.html
+++ b/src/main/java/org/olat/core/commons/editor/htmleditor/_content/htmleditor.html
@@ -43,11 +43,12 @@
 	}
 	
 	## Check for dirtyness and mark buttons accordingly, each second
-	jQuery.periodic({period: 1000, decay:1.0, max_period: Number.MAX_VALUE}, function(executor) {
+	jQuery.periodic({period: 1000, decay:1.0, max_period: Number.MAX_VALUE}, function() {
+		var executor = this;
 		## first check if the html editor still exists on this page, otherwhise stop executing this code
 		var elem = jQuery('#$f.getItemId("rtfElement")');
-		if (!elem) {
-			executor.stop();
+		if (elem.length == 0) {
+			executor.cancel();
 		} else if (tinyMCE && tinyMCE.activeEditor) {
 			if (tinyMCE.activeEditor.isDirty()) {
 				o2c=1;
-- 
GitLab