Creating three levels of hierarchy and opening the parameter dialog on the third one result in out of memory exception.
Reported by Johan Wesselink
BUG DESCRIPTION:
----------------
Xcos will report a out of memory java traceback when a diagram has more than 2 layers of hierarchy and
you try to open the Multiple values dialog from a block on the third hierarcy level.
ERROR LOG:
----------
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:3181)
at java.util.ArrayList.grow(ArrayList.java:261)
at java.util.ArrayList.ensureExplicitCapacity(ArrayList.java:235)
at java.util.ArrayList.ensureCapacityInternal(ArrayList.java:227)
at java.util.ArrayList.add(ArrayList.java:458)
at org.scilab.modules.xcos.utils.Stack.push(Unknown Source)
at org.scilab.modules.xcos.graph.XcosDiagram.lookForHierarchy(Unknown Source)
at org.scilab.modules.xcos.graph.XcosDiagram.getContext(Unknown Source)
at org.scilab.modules.xcos.block.actions.BlockParametersAction.actionPerformed(Unknown Source)
at org.scilab.modules.xcos.graph.swing.handler.GraphHandler.openBlock(Unknown Source)
at org.scilab.modules.xcos.graph.swing.handler.GraphHandler.mouseClicked(Unknown Source)
at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:270)
at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:269)
at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:269)
at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:269)
at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:269)
at java.awt.Component.processMouseEvent(Component.java:6528)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6290)
at java.awt.Container.processEvent(Container.java:2234)
at java.awt.Component.dispatchEventImpl(Component.java:4881)
at java.awt.Container.dispatchEventImpl(Container.java:2292)
at java.awt.Component.dispatchEvent(Component.java:4703)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4898)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4542)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4462)
at java.awt.Container.dispatchEventImpl(Container.java:2278)
at java.awt.Window.dispatchEventImpl(Window.java:2750)
at java.awt.Component.dispatchEvent(Component.java:4703)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
HOW TO REPRODUCE THE BUG:
-------------------------
1. Start Xcos
2. Create a new diagram and put for instance Mathematical Operation -> GAINBLK
2. Select and perform a region to superblock. Repeat this step 3 times.
3. Open the respective superblocks until the GAINBLK block is reached try to open this block.
4. Scilab will crash with the above exception in Linux and say nothing in Windows (not on the prompt)
Scilab may keep running depending on the amount of memory available. It can take some time before the above
exception occures.
OTHER INFORMATION:
------------------
I think I already have a patch for this problem. Needs some more testing, but would like to commit it.
Currently reading up on how to commit this patch.
Today 10/5/2017 I checked the last master (git pull) and that one also has the same bug.