Opened 12 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.

  1. Click to open the child dialog for one element.
  1. Cancel.
  1. Click to open the child dialog for the other element.
  1. Make a selection in the child dialog.
  1. 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 12 years ago by Alfonso Martínez de Lizarrondo

Status: newpending

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?

comment:2 Changed 11 years ago by Piotrek Koszuliński

Resolution: expired
Status: pendingclosed
Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy