Summary: | NewtCanvasSWT: no more rendering after detaching editor from the main EclipseRCP app window | ||
---|---|---|---|
Product: | [JogAmp] Newt | Reporter: | crougier |
Component: | swt | Assignee: | Petros Koutsolampros <pjgl> |
Status: | RESOLVED FIXED | ||
Severity: | critical | CC: | bryan.osborn, gouessej, michael.dehoog, sgothel |
Priority: | --- | ||
Version: | 2 | ||
Hardware: | All | ||
OS: | all | ||
Type: | DEFECT | SCM Refs: | |
Workaround: | --- | ||
Bug Depends on: | |||
Bug Blocks: | 969 | ||
Attachments: | Test case that reproduces the bug |
Description
crougier
2013-08-29 18:04:01 CEST
How can this bug be reproduced ? As a unit test (best), manually (bad), or not at all (worst) ? If we are not able to reproduce a bug, we may have to close it. Can confirm that this is indeed an issue. To reproduce, create an Eclipse RCP application, embed a NewtCanvasSWT in a tab, and then detach that tab from the main RCP window so that a new window is created. The NewtCanvasSWT receives two resize events, one with 0,0,0,0, and then another with the correct size. To fix this issue in our application (https://github.com/GeoscienceAustralia/earthsci/issues/123), I overrode the setBounds(int,int,int,int) method of NewtCanvasSWT as follows: @Override public void setBounds(int x, int y, int width, int height) { //do not allow a size of 0,0, because NEWT window becomes invisible super.setBounds(x, y, Math.max(1, width), Math.max(1, height)); } (In reply to comment #2) > Can confirm that this is indeed an issue. To reproduce, create an Eclipse > RCP application, embed a NewtCanvasSWT in a tab, and then detach that tab > from the main RCP window so that a new window is created. The NewtCanvasSWT > receives two resize events, one with 0,0,0,0, and then another with the > correct size. > > To fix this issue in our application > (https://github.com/GeoscienceAustralia/earthsci/issues/123), I overrode the > setBounds(int,int,int,int) method of NewtCanvasSWT as follows: > > @Override > public void setBounds(int x, int y, int width, int height) > { > //do not allow a size of 0,0, because NEWT window becomes invisible > super.setBounds(x, y, Math.max(1, width), Math.max(1, height)); > } Thank you very much for sharing your findings. It confirms what CĂ©line wrote about the resize event: http://forum.jogamp.org/NativeWindowException-Unable-to-lock-surface-tp4029205p4029700.html So how do we proceed with the solution in comment 2 ? Is there a git pull req, or a patch available ? Or shall somebody (Me, Petros) add this change ? (In reply to comment #4) > So how do we proceed with the solution in comment 2 ? > > Is there a git pull req, or a patch available ? > Or shall somebody (Me, Petros) add this change ? Is there any side effect? As I said, there is probably the same problem in NewtCanvasAWT. Created attachment 687 [details]
Test case that reproduces the bug
Overriding setBounds() is just a workaround that worked for us. It would be better to fix the bug itself.
I have attached a simple example that reproduces the bug. Two canvases are created, one with an overridden setSize() and one without. When you click the "Set size to 0,0" button, both canvases disappear with a size of 0,0. When you click "Set size to 50,50", only the workaround canvas reappears.
|