-
Notifications
You must be signed in to change notification settings - Fork 40
Changed: Fixed detaching model.LiveRange in model.LiveSelection. #904
Conversation
I can see you used a different solution than we discussed initially. Was it due to those graveyard ranges or due to https://github.com/ckeditor/ckeditor5-utils/issues/144? If due to https://github.com/ckeditor/ckeditor5-utils/issues/144 then I would wait for that. |
Mostly due to linked issue. Graveyard ranges are whatever. Other solution would be to do: |
I've made a PR in |
I've updated the solution, but keep in mind that it needs ckeditor/ckeditor5-utils#145 |
This fix should work with changes in The main difference that prevents memory leaks is changing this: this.listenTo( liveRange, 'change:range' () => {} ) to: liveRange.on( 'change:range', () => {} ); Above change allows live ranges to be garbage collected because it is important where events are physically stored. As when using liveRange.deatch(); // this is just `liveRange.stopListening()`
// but it only stop listening event registered on this emitter.
// so this would be also needed:
this.stopListening( liveRange ); |
This branch needs to be rebased in the first place :D |
I'd simplify this change to:
on line:
As problematic here is the size of The reason is as previously stated the place where |
AFAIR (and it was a long time ago) what you propose was my initial idea, but @Reinmar wanted a better solution that won't lead to problems in future (hence changes in |
Discareded by #1181. |
Suggested merge commit message (convention)
Fix:
model.LiveSelection
now correctly stops listening to removedmodel.LiveRange
s. Closes ckeditor/ckeditor5#4036.Additional information
After a minute of monkey clicking, there is just one instance of
LiveRange
and alsoLiveSelection
retains just 4kb of data.