| Summary: | CTabFolder throws exception which also can cause leaks and disposed object reference | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Elena Laskavaia <elaskavaia.cdt> | ||||||
| Component: | SWT | Assignee: | Platform-SWT-Inbox <platform-swt-inbox> | ||||||
| Status: | RESOLVED WORKSFORME | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | akurtakov, ericwill, xixiyan | ||||||
| Version: | 4.6 | Keywords: | triaged | ||||||
| Target Milestone: | --- | ||||||||
| Hardware: | PC | ||||||||
| OS: | Linux | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
Note: I don't have snippet but in my example tabs are at the bottom, there are 11 tab and I resize the view vertically to shrink (or horizontally). Weird stuff is shown. Created attachment 258375 [details]
Vertical resize
Created attachment 258376 [details]
Horizontal resize
Coming with a snippet for debugging/reproducing purposes would help fixing/finding the issue. One thing I don't get is why do you create such image/rectangle combo or you mean CTabFolder comes with such values internally. Regarding leaks, have you investigated yourself about reducing them? Leaks are from that background image in CTabFolder. I think because exception is thrown so it does not get to clean up properly. This rectangle from CTabFolder code, if you look at code from stacktace it creates rect with negative bounds and passes it to new Image. I suspect this is caused by some bug in CTabFolder layout but CTabFolder should at least do some sanity check when it comes up with such values for the image. Is this still reproducible? (In reply to Xi Yan from comment #6) > Is this still reproducible? No response from the OP so I am closing this one. Please feel free to re-open it if the issue still reproduces with latest SWT. |
There is an exception in CTabFolder when I try to resize a view containing CTabFolder. I passed bounds to image constructor with values Rectangle {0, -1, 10, -2} which is invalid (where 10/-2 is width/hight) java.lang.IllegalArgumentException: Argument not valid at org.eclipse.swt.SWT.error(SWT.java:4484) at org.eclipse.swt.SWT.error(SWT.java:4418) at org.eclipse.swt.SWT.error(SWT.java:4389) at org.eclipse.swt.graphics.Image.init(Image.java:1476) at org.eclipse.swt.graphics.Image.<init>(Image.java:545) at org.eclipse.swt.custom.CTabFolder.updateBkImages(CTabFolder.java:3847) at org.eclipse.swt.custom.CTabFolder.setButtonBounds(CTabFolder.java:2582) at org.eclipse.swt.custom.CTabFolder.updateItems(CTabFolder.java:3757) at org.eclipse.swt.custom.CTabFolder.updateItems(CTabFolder.java:3688) at org.eclipse.swt.custom.CTabFolder.onResize(CTabFolder.java:2081) at org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.java:337) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4482) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1329) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1353) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1334) at org.eclipse.swt.widgets.Control.setBounds(Control.java:1067) at org.eclipse.swt.widgets.Composite.setBounds(Composite.java:1449) at org.eclipse.swt.widgets.Control.setBounds(Control.java:900) at org.eclipse.swt.layout.GridLayout.layout(GridLayout.java:693) at org.eclipse.swt.layout.GridLayout.layout(GridLayout.java:197) at org.eclipse.swt.widgets.Composite.updateLayout(Composite.java:1666) at org.eclipse.swt.widgets.Composite.setBounds(Composite.java:1452) at org.eclipse.swt.widgets.Control.setBounds(Control.java:900) at org.eclipse.swt.layout.FillLayout.layout(FillLayout.java:204) at org.eclipse.swt.widgets.Composite.updateLayout(Composite.java:1666) at org.eclipse.swt.widgets.Composite.setBounds(Composite.java:1452) at org.eclipse.swt.widgets.Control.setBounds(Control.java:900) at org.eclipse.swt.layout.FillLayout.layout(FillLayout.java:219) at org.eclipse.swt.widgets.Composite.updateLayout(Composite.java:1666) at org.eclipse.swt.widgets.Composite.setBounds(Composite.java:1452) at org.eclipse.swt.widgets.Control.setBounds(Control.java:900) at org.eclipse.swt.layout.FillLayout.layout(FillLayout.java:204) at org.eclipse.swt.widgets.Composite.updateLayout(Composite.java:1666) at org.eclipse.swt.widgets.Composite.setBounds(Composite.java:1452) at org.eclipse.swt.widgets.Control.setBounds(Control.java:867) at org.eclipse.swt.custom.CTabFolderLayout.layout(CTabFolderLayout.java:116) at org.eclipse.swt.widgets.Composite.updateLayout(Composite.java:1666) at org.eclipse.swt.widgets.Composite.setBounds(Composite.java:1452) at org.eclipse.swt.widgets.Control.setBounds(Control.java:867) at org.eclipse.e4.ui.workbench.renderers.swt.SashLayout.setRectangle(SashLayout.java:319) -- Also because disposal of gc and images not done in finally blocks up the chain it causing resource leaks at org.eclipse.swt.custom.CTabFolder.updateItems(CTabFolder.java:3757) - here we will leak gc because setButtonBounds retrows this exception -- Disposed object will be held here CTabFolder.java:3847 if (controlBkImages[i] != null) controlBkImages[i].dispose(); controlBkImages[i] = new Image(control.getDisplay(), bounds); - Since new Image... throws exception above controlBkImages[i] now contains disposed image, not sure if usage of this image will cause problems later...