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

Bug 341327

Summary: [Commands] Handler conflict due to multiple instances of EditorActionBars for one editor id
Product: [Eclipse Project] Platform Reporter: Markus Schorn <mschorn.eclipse>
Component: UIAssignee: Paul Webster <pwebster>
Status: VERIFIED FIXED QA Contact: Paul Webster <pwebster>
Severity: normal    
Priority: P3 CC: daniel_megert, mober.at+eclipse
Version: 3.6.2   
Target Milestone: 3.7 M7   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Fix pwebster: iplog+

Description Markus Schorn CLA 2011-03-30 05:20:14 EDT
I have an edtior with the id 'myEditID'. When this editor throws a PartInitException during EditorPart.init(...) an ErrorEditorPart with id 'myEditID' is created. For this error editor a new instance of EditorActionBars is used, which is not ref-counted.

Nevertheless, when the ErrorEditorPart is closed, the editor manager unrefs the private instance of EditorActionBars and clears the entry for the id 'myEditID' from its cache. The entry cleared is an instance that is in use by an editor.

When opening another editor with id 'myEditID', a new instance of EditorActionBars is created (because the cache has been cleared). 

The second instance of EditorActionBars for the same type of ediotr leads to a handler conflict because 'EditorActionBars.setGlobalHandler(..)' can no longer properly deactivate a previously registered handler.
Comment 1 Markus Schorn CLA 2011-03-30 05:37:05 EDT
Created attachment 192169 [details]
Fix

To fix the issue, the editor manager simply needs to make sure not to remove an EditorActionBars object from the cache that has a positive ref-count.
Comment 2 Paul Webster CLA 2011-04-01 10:34:39 EDT
Released with minor changes.  Thanx Markus!

PW
Comment 3 Dani Megert CLA 2011-04-06 08:03:24 EDT
Good catch!
Comment 4 Paul Webster CLA 2011-04-26 13:41:37 EDT
In I20110425-1800
PW