make sure operationEnd events are not emitted to wrong session

This commit is contained in:
nightwing 2015-03-31 17:00:25 +04:00
commit 4e6d48bf2e

View file

@ -278,6 +278,10 @@ var Editor = function(renderer, session) {
this.setSession = function(session) {
if (this.session == session)
return;
// make sure operationEnd events are not emitted to wrong session
if (this.curOp) this.endOperation();
this.curOp = {};
var oldSession = this.session;
if (oldSession) {
@ -377,6 +381,8 @@ var Editor = function(renderer, session) {
oldSession: oldSession
});
this.curOp = null;
oldSession && oldSession._signal("changeEditor", {oldEditor: this});
session && session._signal("changeEditor", {editor: this});
};