> This PR is based on a discussion that happened over in PR #1324. Some of this > explanation is copied from that thread. > > When `exitNestedEventLoop` is called on the innermost loop the > invokeLaterDispatcher suspends operation until the loop finishes. But if you > immediately start a new event loop the previous one won't finish and the > dispatcher will jam up and stop dispatching indefinitely. > > When the invokeLaterDispatcher is told that the innermost loop is exiting it > sets `leavingNestedEventLoop` to true expecting it to be set to false when > the loop actually exits. When the dispatcher is told that a new event loop > has started it is not clearing `leavingNestedEventLoop` which is causing the > jam. Basically it should follow the same logic used in glass; leaving the > innermost loop updates a boolean indicating that the loop should exit but if > a new loop is started the boolean is set back to a running state since it now > applies to the new loop, not the previous one. > > I suspect the invokeLaterDispatcher exists in part to deal with the specifics > of how deferred runnables are handled on the Mac. I investigated this a bit > and wrote up some comments in the Mac glass code.
Martin Fox has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision: - Linux leaveNestedEventLoop now behaves like Mac and Windows - Merge remote-tracking branch 'upstream/master' into eventloopjam - Merge remote-tracking branch 'upstream/master' into eventloopjam - Background information on how Mac Glass handles invokeLater runnables - Unblock invokeLater runnables when entering new loop just after exiting current one ------------- Changes: - all: https://git.openjdk.org/jfx/pull/1449/files - new: https://git.openjdk.org/jfx/pull/1449/files/12267ce2..7f7574a4 Webrevs: - full: https://webrevs.openjdk.org/?repo=jfx&pr=1449&range=01 - incr: https://webrevs.openjdk.org/?repo=jfx&pr=1449&range=00-01 Stats: 431796 lines in 7768 files changed: 237877 ins; 122608 del; 71311 mod Patch: https://git.openjdk.org/jfx/pull/1449.diff Fetch: git fetch https://git.openjdk.org/jfx.git pull/1449/head:pull/1449 PR: https://git.openjdk.org/jfx/pull/1449