Bug 170493

Summary: GMF Layout service getLayoutNode() does not dispose of off-screen shells
Product: [Modeling] GMF-Runtime Reporter: Kevin Cornell <kcornell>
Component: GeneralAssignee: Cherie Revells <crevells>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 Keywords: api
Version: 1.0.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Kevin Cornell CLA 2007-01-15 11:31:03 EST
I have written a pluglet that creates and manipulates many diagrams. Some of the manipulation require the pluglet to call LayoutService.getLayoutNode(Node node). This method creates off-screen edit parts for the diagram in order to obtain the actual dimensions for the given node. However, the method does not dispose of the edit parts or the underlying Windows shell and controls. As a result, the pluglet runs the first time but on the next run the entire Eclipse application hangs in SWT when it tries to create a new window for one of these off-screen edit parts.

I created a temporary fix that enabled me to run the pluglet multiple times without hanging. The fix is in LayoutService.getLayoutNode(Node node). Just before the return statement, the shell for the off-screen edit part is displosed as follows:

diagramEP.getViewer().getControl().getShell().dispose();

There should probably be a try catch block with a "finally" clause that disposes of the shell.
Comment 1 Kevin Cornell CLA 2007-01-16 15:06:05 EST
I believe this same issue occurs in LayoutService.layoutNodes(List, boolean, String).
Comment 2 Cherie Revells CLA 2007-03-13 13:33:30 EDT
- Deprecated the method createDiagramEditPart(Diagram diagram) in OffscreenEditPartFactory.  Users should call the method that takes a Shell as this method was not disposing the Shell that it created. 
- LayoutService and DiagramRenderUtil methods now temporary create a Shell where needed and then dispose it. 
- PrinterHelper, PrintPreviewHelper, and DiagramPrinter were also creating a diagram editpart without disposing the shell, so I modified the code to dispose the shell.
Comment 3 Eclipse Webmaster CLA 2010-07-19 12:30:27 EDT
[GMF Restructure] Bug 319140 : product GMF and component Runtime Diagram was the original product and component for this bug