Eclipse Kepler (4.3) Windows 7 and RedHat 5.2 JOGL 2.0.2 The NewtCanvasSWT is displayed in an editor of an Eclipse RCP app. When the editor is detached from the main app window to its own window, the 3D scene is no more rendered. The OpenGL context is not destroyed. The NewtCanvasSWT handle a resize event with a height value = 0, hence the window is marked as invisible. Then, other resize events with valid values are handled but the window stay in an invisible state. Originally reported at: http://forum.jogamp.org/NativeWindowException-Unable-to-lock-surface-td4029205.html gouessej said: "You're right, validateNative fails in this case. Edit.: There is still the same kind of test in NewtCanvasAWT :( "
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.
Fixed via bug 969 I assume. Otherwise we need to reopen it.