Opened 13 years ago
Closed 11 years ago
#8771 closed Bug (expired)
getDialogValue in docprops plugin failing to release event handlers
Reported by: | NicHolt | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | General | Version: | 3.6.1 |
Keywords: | Cc: |
Description
Steps to recreate: a page in the docprops dialog with two elements that invoke a child dialog - e.g. colorpicker (in my case a treeview dialog.
- Click to open the child dialog for one element.
- Cancel.
- Click to open the child dialog for the other element.
- Make a selection in the child dialog.
- Click OK.
Expected results:
The first element should be unchanged, and the second should be updated with the value from the child dialog.
Actual result:
BOTH elements are updated with the value from the second invocation of the child dialog.
Explanation: releaseHandlers is not being called in the correct context, so when OK is clicked, there are TWO OK event handlers bound to the dialog, one for the field for which OK was clicked, one ofr the field which was canceled.
The following code explicitly establishes the context both for the event handlers and for releaseHandlers, rather than relying on "this".
var onOk = function() { var dlg = editor._.storedDialogs[dialogName]; // Changed by Nic to fix failure to releaseHandlers correctly releaseHandlers(); callback( dlg, dlg._.parentDialog ); }; var releaseHandlers = function() { var dlg = editor._.storedDialogs[dialogName]; // Changed by Nic to fix failure to releaseHandlers correctly dlg.removeListener( 'ok', onOk ); dlg.removeListener( 'cancel', releaseHandlers ); };
Change History (2)
comment:1 Changed 13 years ago by
Status: | new → pending |
---|
comment:2 Changed 11 years ago by
Resolution: | → expired |
---|---|
Status: | pending → closed |
I'm not able to reproduce this bug in the doc properties dialog or the cell dialog. Maybe it's related to some other changes that you have done in #8749?