Bug 275288 - Application freezes in BorderItemLocator.locateOnBorder
Summary: Application freezes in BorderItemLocator.locateOnBorder
Status: RESOLVED FIXED
Alias: None
Product: GMF-Runtime
Classification: Modeling
Component: General (show other bugs)
Version: 2.2   Edit
Hardware: PC Windows XP
: P3 major
Target Milestone: 2.2   Edit
Assignee: Alex Boyko CLA
QA Contact:
URL:
Whiteboard: 2.1.4 Patch
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-07 07:47 EDT by Peter Lang CLA
Modified: 2010-07-19 21:57 EDT (History)
2 users (show)

See Also:


Attachments
My.ecore - model to reproduce (921 bytes, text/plain)
2009-05-07 07:48 EDT, Peter Lang CLA
no flags Details
generated model files + default.my to reproduce (6.16 KB, application/zip)
2009-05-22 06:01 EDT, Peter Lang CLA
no flags Details
patch committed for 2.2 (1.52 KB, patch)
2009-05-22 12:41 EDT, Alex Boyko CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Lang CLA 2009-05-07 07:47:16 EDT
Build ID: I20090313-0100

Steps To Reproduce:
I can reproduce the problem with ports containing labels sticking to nodes. It occurs when a new port containing some text needs to be laid-out.
I guess the label is not the reason, but that's how I can reproduce it.

1. Create "New GMF Project"

2. Add My.ecore (attached):
+ MyRoot
  + MyNode
   + MyPort
     -> portName

3. Derive genmodel, generate model and edit sources

4. Derive gmftool (no tools required to reproduce)

5.1 Derive gmfgraph using MyRoot as Diagram Element
    (MyNode, MyPort as nodes, portName as attribute)

5.2 set Affixed Parent Side of child-Node MyPort to "NORTH"

6.2 Combine to gmfmap (generate MyNode as node)

6.2 add MyPort as Child Reference including Node Mapping to MyNode Node Mapping

6.3 add Feature Label Mapping to MyPort Node Mapping, displaying portName

7. Run (after generating sources)

8. Initialize my_diagram diagram file
  <?xml version="1.0" encoding="UTF-8"?>
  <test:MyRoot xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:test="test">
    <myNode>
      <myPort portName="a"/>
      <myPort portName="b"/>
      <myPort portName="c"/>
      <myPort portName="ddddd"/>
    </myNode>
  </test:MyRoot>

In case this does not work try to add more ports and increase length of portName-attribute.

More information:
The application seems to be looping forever in
org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator locateBorder trying to getConflictingBorderItemFigure.

It works with a decreased text-length of port "ddddd".

I'm new to both Eclipse and GMF, so feel free to correct me.
Comment 1 Peter Lang CLA 2009-05-07 07:48:05 EDT
Created attachment 134768 [details]
My.ecore - model to reproduce
Comment 2 Alex Shatalin CLA 2009-05-11 08:45:26 EDT
Looks like defect in org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator. REassiginig to runtime component.
Comment 3 Alex Boyko CLA 2009-05-21 00:03:02 EDT
I see that the last issue fixed in BorderItemLocator was the infinite loop in locateOnBorder method bug 243594. The fact that smaller labels make it work sounds familiar... similar to the problem fixed in 243594, when the size of the border item being laid out (located) is smaller then the size of the conflicting border item then problem manifests. Are you sure that your GMF version is 2.2 or 2.1.3? Well... anything after September 2008?

If yes, can you attach your generated editor plug-ins please? So, I can debug/fix this for you.
Comment 4 Peter Lang CLA 2009-05-22 06:01:15 EDT
Created attachment 136787 [details]
generated model files + default.my to reproduce

Yes, I can reproduce it with GMF 2.2.0

Just create a new GMF project called "bugzilla_275288", add the attached model-files, generated sources, run and try to "Initialize my_diagram diagram file" test/default.my.

Please let me know if there is anything else I can provide...
Comment 5 Alex Boyko CLA 2009-05-22 12:39:33 EDT
Fixed for 2.2.

The problem is that we can't use the bounds of the border item until it's laid out, so preferred size of the border item needs to be used. The new #getNextNonConflictingLocation(...) method was looking at the bounds of the border item regardless whether it was laid out or not. In this case it wasn't laid out, so bounds of the border item may not be valid (not included the width of the label in this case), while all other methods were including the size of the label. Henece the next conflicting location was always conflicting with the same border item and hence infinite loop.

Anthony, perhaps we'd like to have this fix as 2.1.4 patch as well?
Comment 6 Alex Boyko CLA 2009-05-22 12:41:44 EDT
Created attachment 136825 [details]
patch committed for 2.2

Trivial fix
Comment 7 Alex Boyko CLA 2009-05-22 14:10:09 EDT
Ok, I'd recommend this patch for 2.1.4 patch build. It's a silly mistake that I made and it leads to some serious bad consequences, which clients didn't have to deal with before (regression from 2.1). I think it's worth putting this in a 2.1.4 patch as well. What do you think, Anthony?
Comment 8 Alex Boyko CLA 2009-05-29 11:59:49 EDT
Committed the fix to maintenance too.
Comment 9 Eclipse Webmaster CLA 2010-07-16 23:36:00 EDT
[target cleanup] 2.2 RC was the original target milestone for this
bug
Comment 10 Eclipse Webmaster CLA 2010-07-19 21:57:20 EDT
[GMF Restructure] Bug 319140 : product GMF and component
Runtime was the original product and component for this bug