Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 359582 - DiagramEventBroker doesn't check if the WeakReference's get() method returns null
Summary: DiagramEventBroker doesn't check if the WeakReference's get() method returns ...
Status: RESOLVED FIXED
Alias: None
Product: GMF-Runtime
Classification: Modeling
Component: General (show other bugs)
Version: 1.4.2   Edit
Hardware: PC Windows 7
: P3 critical
Target Milestone: 1.6.1   Edit
Assignee: Anthony Hunter CLA
QA Contact:
URL:
Whiteboard: 1.4.3 Patch
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-30 11:48 EDT by Wayne CLA
Modified: 2012-08-24 11:21 EDT (History)
1 user (show)

See Also:


Attachments
Patch for DiagramEventBroker (2.01 KB, patch)
2011-09-30 11:49 EDT, Wayne CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.