On Fri, 13 Dec 2019 10:48:37 GMT, Ambarish Rapte <ara...@openjdk.org> wrote:
>>> This is moved only to make first operation when disposing. However the race >>> condition is very rare, but this will just reduce the chances little more. >> >> Can you elaborate? Why would there still be a race condition? > >> Can you elaborate? Why would there still be a race condition? > > Hi Kevin, Looks like I made a confusing statement. > There won't be a race condition after this change but there can be a > situation when `frameRendered()` gets executed while `dispose()` is in > progress. > Consider scenario: > 1. `dispose()` is called on Application thread, and > `setTKScenePaintListener(null)` is not executed yet. > 2. `frameRendered()` is called on Renderer thread, and it will find that > scenePaintListener is not null and `scenePaintListener.frameRendered()` call > will be executed. > 3. Then `dispose()` executes `setTKScenePaintListener(null)` > > If `setTKScenePaintListener(null)` is the first operation in 'dispose()' then > chances of above situation reduce little more. However the situation is very > rare. > This is to make it more sure that `scenePaintListener.frameRendered()` does > not get executed once `dispose()` has begun. OK, thanks. That's what I would have expected, but wanted to make sure there wasn't still an outstanding race condition after your fix. This is a safe enough fix that one reviewer is sufficient. ------------- PR: https://git.openjdk.java.net/jfx/pull/64