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

Bug 359582

Summary: DiagramEventBroker doesn't check if the WeakReference's get() method returns null
Product: [Modeling] GMF-Runtime Reporter: Wayne <wdiu>
Component: GeneralAssignee: Anthony Hunter <ahunter.eclipse>
Status: RESOLVED FIXED QA Contact:
Severity: critical    
Priority: P3 CC: ahunter.eclipse
Version: 1.4.2   
Target Milestone: 1.6.1   
Hardware: PC   
OS: Windows 7   
Whiteboard: 1.4.3 Patch
Attachments:
Description Flags
Patch for DiagramEventBroker none

Description Wayne CLA 2011-09-30 11:48:24 EDT
Build Identifier: org.eclipse.gmf.runtime.diagram.core_1.4.0.v20100331-2359

Using org.eclipse.gmf.runtime.diagram.core_1.4.0.v20100331-2359.

DiagramEventBroker.initializeDiagramEventBroker(TransactionalEditingDomain) fails to check if the WeakReference's get() method returns null, resulting in a null DiagramEventBroker being returned and unpredictable behavior by anything which obtains the DiagramEventBroker and then decides to use it.

Ideally, the initialize method should reconstruct and return a properly initialized DiagramEventBroker even when the get() method returns null.

Reproducibility will depend on your version of Java and, in particular, the garbage collection.

Patch attached.

Reproducible: Sometimes
Comment 1 Wayne CLA 2011-09-30 11:49:06 EDT
Created attachment 204396 [details]
Patch for DiagramEventBroker
Comment 2 Anthony Hunter CLA 2012-02-14 21:55:22 EST
Committed to gmf-R1_4_maintenance
Tagged the bundle as v20120214-0143
Comment 3 Anthony Hunter CLA 2012-02-14 21:55:58 EST
Committing to HEAD (1.6.0) for Juno
Comment 4 Anthony Hunter CLA 2012-08-24 11:21:08 EDT
Not sure what happened, but this was put into an older maintenance stream (1.4.3) but not Juno.

I have now delivered into Juno for 1.6.1 and also head for 1.7.