Ticket #1573 (closed Bug: fixed)
OnSelectionChange fired when document is unloaded
| Reported by: | matthiasmiller | Owned by: | martinkou |
|---|---|---|---|
| Priority: | Normal | Milestone: | FCKeditor 2.5 |
| Component: | General | Version: | |
| Keywords: | Cc: |
Description
The OnSelectionChange event is sometimes being fired in IE even when the document is unloaded. Most event handlers assume that a document is currently loaded.
The included patch works for me.
Attachments
Change History
comment:1 Changed 5 years ago by alfonsoml
In #1498 (and some later dups) this problem was generating a crash in IE.
Besides this protection it might be a good idea to remove all the event listeners that are able to be fired even when the document is being destroyed, in a way similar to the FCK_Cleanup() but making sure that all the events that have been attached are removed, references to objects cleaned up (#1574) and the like, whenever the document is destroyed (due to switching modes or to unload of the page)
comment:2 Changed 5 years ago by martinkou
- Status changed from new to assigned
- Owner set to martinkou
comment:3 Changed 5 years ago by martinkou
- Status changed from assigned to closed
- Resolution set to fixed
A listener cleanup logic would not eliminate all checks for FCK.EditorDocument and FCK.EditorWindow in all event handlers, because not all event handlers should be detached (e.g. click handlers of toolbar buttons) when the editor frame unloads. So I think putting sanity checks in the event handlers would be a better approach, and it is what is already done in many event handlers and functions called by event handlers (e.g. in the GetState() function of many commands). The current approach isn't perfect, as seen in this ticket, but putting things on cleanup wouldn't eliminate all potential problems either.
I've merged matthiasmiller's patch to trunk in [1122].
