Bug 643 - SWT 'display.asyncExec(Runnable runnable)' runnable not executed until SWT display disposed on Windows w/ NEWT windows parented (NewtCanvasSWT)
Summary: SWT 'display.asyncExec(Runnable runnable)' runnable not executed until SWT di...
Status: RESOLVED FIXED
Alias: None
Product: Newt
Classification: JogAmp
Component: core (show other bugs)
Version: 1
Hardware: pc_x86_64 windows
: --- normal
Assignee: Sven Gothel
URL:
Depends on:
Blocks:
 
Reported: 2012-11-29 10:31 CET by samuel.gratzl
Modified: 2012-12-02 04:25 CET (History)
0 users

See Also:
Type: ---
SCM Refs:
jogl 0bb202f2883e1eb82256140f13310046f7b13c62 jogl f0f58e120817b57ed3fb70c238001579a68e4064 jogl 571c21df9310d043b08a4a72064617cbe6eee0fa
Workaround: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description samuel.gratzl 2012-11-29 10:31:59 CET
see also: http://forum.jogamp.org/NEWT-blocks-SWT-Thread-td4027270.html

It seems to be that the NEWT windows blocks the SWT Thread. 

under https://bitbucket.org/sgratzl/jogltest there is a litte test setup based on 2.0-rc11

the project testjogl3 contains two classes. The first one uses a SWT GLCanvas to render the triangle the other one the NEWT Canvas / Window. 

In both classes a SWT messagebox should appear as soon as the glcontext is initialized, using Display.asyncExec. However only the SWT test case will open the popup, whereas the NEWT test case blocks the SWT thread and after the NEWT window is closed the Messagebox (would) appear.
Comment 1 Sven Gothel 2012-11-29 16:15:01 CET
As described w/ the title change, the
Comment 2 Sven Gothel 2012-11-29 16:20:20 CET
display.asyncExec(Runnable runnable) enqueues the runnable for later execution on the SWT UI thread.

SWT's impl. shall execute the runnables at display.readAndDispatch().
On Windows, this is performed either while not having anymore native events to dispatch,
or if executing these runnables is allowed w/ native event dispatching (disabled  per default).
Processing the runnables is done in Display/Synchronizer: runAsyncMessages(..).

NewtCanvasSWT does not block SWT's dispatching,
however none of these runnables gets processed.

The reason is unknown and under investigation.
Comment 3 Sven Gothel 2012-11-29 18:22:36 CET
<http://jogamp.org/git/?p=jogl.git;a=commit;h=0bb202f2883e1eb82256140f13310046f7b13c62>

Bug628: Adding unit-test 'TestNewtCanvasSWTBug628ResizeDeadlock' exposing NewtCanvasSWT asyncExec(..) bug w/ native parenting

The unit test shows, that while using JOGL's SWT GLCanvas Display's asyncExec(..) works properly,
but w/ NewtCanvasSWT on Windows does not.

NewtCanvasSWT differs w/:
  - Using native parenting [Newt GLWindow to SWT Canvas]
  - Processing native events in own NEWT EDT, w/ own Windows dispatch hook [For the child GLWindow only]
Comment 4 Sven Gothel 2012-11-29 18:23:32 CET
Should read: Bug643 - not - Bug628
Comment 5 Sven Gothel 2012-12-02 04:25:09 CET
Fixed ..

<http://jogamp.org/git/?p=jogl.git;a=commit;h=f0f58e120817b57ed3fb70c238001579a68e4064>

Fix Bug 643: SWT 'display.asyncExec(Runnable runnable)' runnable not executed on Windows

Turns out that the NEWT Windows impl. didn't properly validated the client region @ WM_PAINT
and hence 'exhausted' the message pipeline, i.e. never reached an IDLE state.

The latter caused SWT to never reach a point where deferred asyncExec(..) Runnables
got processed.

Besides this SWT effect, this also caused a NEWT window on Windows to always repaint itself (?).

+++

<http://jogamp.org/git/?p=jogl.git;a=commit;h=571c21df9310d043b08a4a72064617cbe6eee0fa>

...

Enhance Bug 643 unit test: Also test NEWT EDT and pre-visible GLWindow.