Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 348969

Summary: TaskDataModelListener not removed when attributes section not expanded
Product: z_Archived Reporter: Sam Davis <sam.davis>
Component: MylynAssignee: Sam Davis <sam.davis>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: steffen.pingel
Version: unspecifiedKeywords: contributed
Target Milestone: 3.6.2   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
add listener only when the setControl is called
none
add listener only when the setControl is called
none
RichTextAttributeEditor patch none

Description Sam Davis CLA 2011-06-09 17:28:49 EDT
When AbstractAttributeEditor is created, it adds a TaskDataModelListener to the TaskDataModel, and this listener is removed when the editor's control is disposed. However, if the attributes section is not expanded, the control is never created, and thus not diposed, so the model listener is never removed. This means that if you open a task editor without expanding the attributes section and repeatedly refresh it, you will add another model listener with every refresh.
Comment 1 Sam Davis CLA 2011-06-09 17:29:41 EDT
Created attachment 197745 [details]
add listener only when the setControl is called
Comment 2 Sam Davis CLA 2011-06-09 17:33:11 EDT
Created attachment 197746 [details]
add listener only when the setControl is called
Comment 3 Sam Davis CLA 2011-06-09 21:16:38 EDT
Created attachment 197748 [details]
RichTextAttributeEditor patch

When RichTextAttributeEditor is created, it calls RichTextEditor.setText() with the current value of its attribute. However, with the change above, if the attribute value changes before the control is created, this change will not be reflected in the control. This patch will call setText again when creating the control.
Comment 4 Steffen Pingel CLA 2011-08-26 13:24:57 EDT
Thanks Sam. Committed as 44ccf7a03a524bbe5f42214f127d9880b4d6b0a7 to e_3_7_m_3_6_x branch and master.
Comment 5 Steffen Pingel CLA 2011-08-27 17:06:19 EDT
Committed 995030b13e81646276a539a7c90d3077e9d1bd73 to address rendering problem with WikiText (e.g. bug 348237). The original patch did not have this problem, it was caused by me when reordering the refresh call.