Re: RFR: 8322784: JFXPanel calls InputMethodRequests on wrong thread [v2]

2024-01-22 Thread Andy Goryachev
On Mon, 22 Jan 2024 22:13:42 GMT, Martin Fox wrote: > this pattern is used throughout the code base. that might be the case, but I think we should use the right pattern for the new code. single-element array is an anachronism, especially in the case of multi-threaded code as here. ---

Re: RFR: 8322784: JFXPanel calls InputMethodRequests on wrong thread [v2]

2024-01-22 Thread Martin Fox
On Mon, 22 Jan 2024 21:06:01 GMT, Andy Goryachev wrote: >> Again, thread-safety isn't an issue here. Even if the OS were to invoke the >> IM methods on different threads (which is a terrifying thought) these >> adapters are created on a per-call basis so each thread would get its own >> instan

Re: RFR: 8322784: JFXPanel calls InputMethodRequests on wrong thread [v2]

2024-01-22 Thread Andy Goryachev
On Mon, 22 Jan 2024 20:52:56 GMT, Martin Fox wrote: >> I might be wrong, but array would need to store its size (an int, 8 bytes on >> 64 bit machines) in addition to the pointers themselves, while >> AtomicReference needs just the pointer. >> Plus, its semantics is much cleaner. > > Again, thr

Re: RFR: 8322784: JFXPanel calls InputMethodRequests on wrong thread [v2]

2024-01-22 Thread Martin Fox
On Mon, 22 Jan 2024 15:45:25 GMT, Andy Goryachev wrote: >> Either an array or an AtomicReference is OK in this case. AtomicReference is >> thread-safe, but that's not a concern here, since using `runAndWait` ensures >> that writing to the array happens before reading it. > > I might be wrong, b

Re: RFR: 8322784: JFXPanel calls InputMethodRequests on wrong thread [v2]

2024-01-22 Thread Andy Goryachev
On Sat, 20 Jan 2024 14:07:32 GMT, Kevin Rushforth wrote: >> I'm not familiar enough with AtomicReference to have an opinion on this. >> Someone else will have to weigh in on this. > > Either an array or an AtomicReference is OK in this case. AtomicReference is > thread-safe, but that's not a co

Re: RFR: 8322784: JFXPanel calls InputMethodRequests on wrong thread [v2]

2024-01-20 Thread Kevin Rushforth
On Sat, 20 Jan 2024 01:08:23 GMT, Martin Fox wrote: >> modules/javafx.swing/src/main/java/javafx/embed/swing/InputMethodSupport.java >> line 132: >> >>> 130: } >>> 131: if (selected[0] == null) selected[0] = ""; >>> 132: return new AttributedString(selected[0

Re: RFR: 8322784: JFXPanel calls InputMethodRequests on wrong thread [v2]

2024-01-20 Thread Kevin Rushforth
On Fri, 19 Jan 2024 16:15:10 GMT, Martin Fox wrote: >> On Windows we need to ensure InputMethodRequests coming from JFXPanel are >> processed on the JavaFX application thread instead of the AWT EventQueue >> thread. This PR adds the runAndWait() calls to do that. >> >> This would be difficult

Re: RFR: 8322784: JFXPanel calls InputMethodRequests on wrong thread [v2]

2024-01-19 Thread Martin Fox
On Fri, 19 Jan 2024 23:39:59 GMT, Andy Goryachev wrote: >> Martin Fox has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Switched to local array variables > > I think this code crashes on macOS with Arabic input... > > correction: not cras

Re: RFR: 8322784: JFXPanel calls InputMethodRequests on wrong thread [v2]

2024-01-19 Thread Andy Goryachev
On Fri, 19 Jan 2024 16:15:10 GMT, Martin Fox wrote: >> On Windows we need to ensure InputMethodRequests coming from JFXPanel are >> processed on the JavaFX application thread instead of the AWT EventQueue >> thread. This PR adds the runAndWait() calls to do that. >> >> This would be difficult

Re: RFR: 8322784: JFXPanel calls InputMethodRequests on wrong thread [v2]

2024-01-19 Thread Andy Goryachev
On Fri, 19 Jan 2024 16:15:10 GMT, Martin Fox wrote: >> On Windows we need to ensure InputMethodRequests coming from JFXPanel are >> processed on the JavaFX application thread instead of the AWT EventQueue >> thread. This PR adds the runAndWait() calls to do that. >> >> This would be difficult

Re: RFR: 8322784: JFXPanel calls InputMethodRequests on wrong thread [v2]

2024-01-19 Thread Andy Goryachev
On Fri, 19 Jan 2024 16:15:10 GMT, Martin Fox wrote: >> On Windows we need to ensure InputMethodRequests coming from JFXPanel are >> processed on the JavaFX application thread instead of the AWT EventQueue >> thread. This PR adds the runAndWait() calls to do that. >> >> This would be difficult

Re: RFR: 8322784: JFXPanel calls InputMethodRequests on wrong thread [v2]

2024-01-19 Thread Martin Fox
> On Windows we need to ensure InputMethodRequests coming from JFXPanel are > processed on the JavaFX application thread instead of the AWT EventQueue > thread. This PR adds the runAndWait() calls to do that. > > This would be difficult to test on Windows without a fix for > [JDK-8090267](https