Re: RFR: 8330462: StringIndexOutOfBoundException when typing anything into TextField [v6]

2024-04-18 Thread Oliver Kopp
On Thu, 18 Apr 2024 20:19:19 GMT, Oliver Kopp wrote: >> modules/javafx.graphics/src/main/java/com/sun/glass/ui/win/WinTextRangeProvider.java >> line 365: >> >>> 363: if (text == null) return null; >>> 364: validateRange(text); >>> 365: int endOffset = maxLength >= 0 ? Ma

Re: RFR: 8330462: StringIndexOutOfBoundException when typing anything into TextField [v6]

2024-04-18 Thread Oliver Kopp
> Fixes https://bugs.openjdk.org/browse/JDK-8330462. > > If the parameter `maxLength` is larger than `Integer.MAX_VALUE - start`, then > an addition of `start` to it leads to a negative value. This is "fixed" by > using `Math.max` comparing the `maxLength` and `maxLength + start`. Oliver Kopp h

Re: Possible leak on setOnAction

2024-04-18 Thread John Hendrikx
This probably is a common mistake, however the Weak wrapper is also easy to use wrongly.  You can't just wrap it like you are doing in your example, because this is how the references look: menuItem ---> WeakEventHandler ---weakly---> Lambda In effect, the Lambda is weakly referenced, and

Re: Possible leak on setOnAction

2024-04-18 Thread Nir Lisker
I didn't find such memory leaks in my application, though I don't do stage handling. What I would look at is where the `stage` reference in the lambda is coming from. You say you have a list of open stages. When you close a stage, do you remove the references to that stage from all places? What abo

Re: RFR: 8146918: ConcurrentModificationException in MediaPlayer

2024-04-18 Thread Alexander Matveev
On Thu, 22 Feb 2024 17:16:42 GMT, n-gabe wrote: > There is a ConcurrentModificationException in MediaPlayer when removing a > MediaView from it. The root cause is that you can't iterate over a HashSet > with for (WeakReference vref : viewRefs) and removing items from > the collection by viewRe

Re: RFR: 8242553: IntegerSpinner and DoubleSpinner do not wrap around values correctly in some cases [v2]

2024-04-18 Thread Andy Goryachev
On Wed, 10 Apr 2024 11:47:28 GMT, drmarmac wrote: >> This PR should fix the issue and cover all relevant cases with new tests. >> >> Note: This involves a small behavior change, as can be seen in >> dblSpinner_testWrapAround_decrement_twoSteps() in SpinnerTest.java:749. With >> this change the

Re: RFR: 8242553: IntegerSpinner and DoubleSpinner do not wrap around values correctly in some cases [v2]

2024-04-18 Thread Kevin Rushforth
On Wed, 10 Apr 2024 11:47:28 GMT, drmarmac wrote: >> This PR should fix the issue and cover all relevant cases with new tests. >> >> Note: This involves a small behavior change, as can be seen in >> dblSpinner_testWrapAround_decrement_twoSteps() in SpinnerTest.java:749. With >> this change the

Re: RFR: 8322251: [Linux] JavaFX is not displaying CJK on Ubuntu 23.10 and later

2024-04-18 Thread Andy Goryachev
On Wed, 10 Apr 2024 19:01:57 GMT, Phil Race wrote: > The Linux font lookup code is rejecting CFF OpenType fonts. > Since these are becoming common because of the Noto family this could soon be > quite a problem. > I expect this fix is a candidate for backporting. thank you @beldenfox for confir

Re: RFR: 8322251: [Linux] JavaFX is not displaying CJK on Ubuntu 23.10 and later

2024-04-18 Thread Martin Fox
On Wed, 10 Apr 2024 19:01:57 GMT, Phil Race wrote: > The Linux font lookup code is rejecting CFF OpenType fonts. > Since these are becoming common because of the Noto family this could soon be > quite a problem. > I expect this fix is a candidate for backporting. I already had 23.10 ARM VM's co

Re: RFR: 8330462: StringIndexOutOfBoundException when typing anything into TextField [v5]

2024-04-18 Thread Kevin Rushforth
On Thu, 18 Apr 2024 21:27:12 GMT, Oliver Kopp wrote: >> Fixes https://bugs.openjdk.org/browse/JDK-8330462. >> >> If the parameter `maxLength` is larger than `Integer.MAX_VALUE - start`, >> then an addition of `start` to it leads to a negative value. This is "fixed" >> by using `Math.max` compa

Re: RFR: 8330462: StringIndexOutOfBoundException when typing anything into TextField [v5]

2024-04-18 Thread Oliver Kopp
> Fixes https://bugs.openjdk.org/browse/JDK-8330462. > > If the parameter `maxLength` is larger than `Integer.MAX_VALUE - start`, then > an addition of `start` to it leads to a negative value. This is "fixed" by > using `Math.max` comparing the `maxLength` and `maxLength + start`. Oliver Kopp h

RFR: 8146918: ConcurrentModificationException in MediaPlayer

2024-04-18 Thread n-gabe
There is a ConcurrentModificationException in MediaPlayer when removing a MediaView from it. The root cause is that you can't iterate over a HashSet with for (WeakReference vref : viewRefs) and removing items from the collection by viewRefs.remove(vref); within this loop. - Commit

Re: RFR: 8330462: StringIndexOutOfBoundException when typing anything into TextField [v4]

2024-04-18 Thread Oliver Kopp
> Fixes https://bugs.openjdk.org/browse/JDK-8330462. > > If the parameter `maxLength` is larger than `Integer.MAX_VALUE - start`, then > an addition of `start` to it leads to a negative value. This is "fixed" by > using `Math.max` comparing the `maxLength` and `maxLength + start`. Oliver Kopp h

Re: RFR: 8330462: StringIndexOutOfBoundException when typing anything into TextField [v3]

2024-04-18 Thread Oliver Kopp
On Thu, 18 Apr 2024 15:10:47 GMT, Andy Goryachev wrote: >> Oliver Kopp has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Fix handling of requestedSteps < 0 > > modules/javafx.graphics/src/main/java/com/sun/glass/ui/win/WinTextRangeProvider

Re: RFR: 8330462: StringIndexOutOfBoundException when typing anything into TextField [v3]

2024-04-18 Thread Oliver Kopp
> Fixes https://bugs.openjdk.org/browse/JDK-8330462. > > If the parameter `maxLength` is larger than `Integer.MAX_VALUE - start`, then > an addition of `start` to it leads to a negative value. This is "fixed" by > using `Math.max` comparing the `maxLength` and `maxLength + start`. Oliver Kopp h

Re: RFR: 8330462: StringIndexOutOfBoundException when typing anything into TextField [v2]

2024-04-18 Thread Oliver Kopp
> Fixes https://bugs.openjdk.org/browse/JDK-8330462. > > If the parameter `maxLength` is larger than `Integer.MAX_VALUE - start`, then > an addition of `start` to it leads to a negative value. This is "fixed" by > using `Math.max` comparing the `maxLength` and `maxLength + start`. Oliver Kopp h

Re: RFR: 8330462: StringIndexOutOfBoundException when typing anything into TextField

2024-04-18 Thread Oliver Kopp
On Thu, 18 Apr 2024 14:44:12 GMT, Andy Goryachev wrote: > would this fix need to be backported? how far back? Yes - JavaFX 22 would be helpful for me. `8u20-b12` was the first tag appearing with that code. -- I checked "git blame" https://github.com/openjdk/jfx/blame/master/modules/javafx.grap

Re: RFR: 8330462: StringIndexOutOfBoundException when typing anything into TextField

2024-04-18 Thread Oliver Kopp
On Thu, 18 Apr 2024 15:17:54 GMT, Kevin Rushforth wrote: > I'd like to see a test, if possible. Where can I find hints on this? I would use TestFX, fire up some minimal app and try to hit the branches of WinTextRangeProvider. However, I did not find TestFX as used. And there is no `javafx.gra

Re: RFR: 8322251: [Linux] JavaFX is not displaying CJK on Ubuntu 23.10 and later

2024-04-18 Thread Phil Race
On Thu, 18 Apr 2024 14:18:43 GMT, Andy Goryachev wrote: > the code looks right, I just can't verify the fix on a real system. Well, yes, I had to install 23.10 in a VirtualBox VM, then clone FX on to it along with all the tools needed to build and test. So it is definitely something that needs

Re: [External] : Re: Possible leak on setOnAction

2024-04-18 Thread Andy Goryachev
Well, then all these setOnXXX() should mention it as well, wouldn't you say? Perhaps a better solution might be a general purpose tutorial which addresses the common pitfalls like memory leaks, and new features like Subscription. We do have these tutorials for java8 - https://docs.oracle.com/ja

Re: Possible leak on setOnAction

2024-04-18 Thread Thiago Milczarek Sayão
I was investigating, It probably should be menuItem.setOnAction(new WeakEventHandler<>(e -> stage.toFront())); But I bet it's a common mistake. Maybe the setOnAction should mention it? Em qui., 18 de abr. de 2024 às 11:54, Andy Goryachev < andy.goryac...@oracle.com> escreveu: > You are correc

Re: RFR: 8330462: StringIndexOutOfBoundException when typing anything into TextField

2024-04-18 Thread Kevin Rushforth
On Thu, 18 Apr 2024 12:01:52 GMT, Oliver Kopp wrote: > Fixes https://bugs.openjdk.org/browse/JDK-8330462. > > If the parameter `maxLength` is larger than `Integer.MAX_VALUE - start`, then > an addition of `start` to it leads to a negative value. This is "fixed" by > using `Math.max` comparing

Re: RFR: 8330462: StringIndexOutOfBoundException when typing anything into TextField

2024-04-18 Thread Andy Goryachev
On Thu, 18 Apr 2024 12:01:52 GMT, Oliver Kopp wrote: > Fixes https://bugs.openjdk.org/browse/JDK-8330462. > > If the parameter `maxLength` is larger than `Integer.MAX_VALUE - start`, then > an addition of `start` to it leads to a negative value. This is "fixed" by > using `Math.max` comparing

Re: Possible leak on setOnAction

2024-04-18 Thread Andy Goryachev
You are correct - the lambda strongly references `stage` and since it is in turn is strongly referenced from the menu item it creates a leak. The lambda is essentially this: menuItem.setOnAction(new H(stage)); class $1 implements EventHandler { private final Stage stage; public $1(Stage s) {

Re: RFR: 8330462: StringIndexOutOfBoundException when typing anything into TextField

2024-04-18 Thread Andy Goryachev
On Thu, 18 Apr 2024 12:01:52 GMT, Oliver Kopp wrote: > Fixes https://bugs.openjdk.org/browse/JDK-8330462. > > If the parameter `maxLength` is larger than `Integer.MAX_VALUE - start`, then > an addition of `start` to it leads to a negative value. This is "fixed" by > using `Math.max` comparing

Re: RFR: 8330462: StringIndexOutOfBoundException when typing anything into TextField

2024-04-18 Thread Andy Goryachev
On Thu, 18 Apr 2024 12:01:52 GMT, Oliver Kopp wrote: > Fixes https://bugs.openjdk.org/browse/JDK-8330462. > > If the parameter `maxLength` is larger than `Integer.MAX_VALUE - start`, then > an addition of `start` to it leads to a negative value. This is "fixed" by > using `Math.max` comparing

Re: RFR: 8322251: [Linux] JavaFX is not displaying CJK on Ubuntu 23.10 and later

2024-04-18 Thread Andy Goryachev
On Wed, 10 Apr 2024 19:01:57 GMT, Phil Race wrote: > The Linux font lookup code is rejecting CFF OpenType fonts. > Since these are becoming common because of the Noto family this could soon be > quite a problem. > I expect this fix is a candidate for backporting. the code looks right, I just ca

RFR: 8330462: StringIndexOutOfBoundException when typing anything into TextField

2024-04-18 Thread Oliver Kopp
Fixes https://bugs.openjdk.org/browse/JDK-8330462. If the parameter `maxLength` is larger than `Integer.MAX_VALUE - start`, then an addition of `start` to it leads to a negative value. This is "fixed" by using `Math.max` comparing the `maxLength` and `maxLength + start`. - Commit m

Re: RFR: 8322251: [Linux] JavaFX is not displaying CJK on Ubuntu 23.10 and later

2024-04-18 Thread Ajit Ghaisas
On Wed, 10 Apr 2024 19:01:57 GMT, Phil Race wrote: > The Linux font lookup code is rejecting CFF OpenType fonts. > Since these are becoming common because of the Noto family this could soon be > quite a problem. > I expect this fix is a candidate for backporting. The fix looks straightforward a

Possible leak on setOnAction

2024-04-18 Thread Thiago Milczarek Sayão
Hi, I'm pretty sure setOnAction is holding references. I have a "Open Windows" menu on my application where it lists the Stages opened and if you click, it calls stage.toFront(): menuItem.seOnAction(e -> stage.toFront()) I had many crash reports, all OOM. I got the hprof files and analyzed them

Integrated: 8242553: IntegerSpinner and DoubleSpinner do not wrap around values correctly in some cases

2024-04-18 Thread drmarmac
On Sun, 24 Mar 2024 15:11:16 GMT, drmarmac wrote: > This PR should fix the issue and cover all relevant cases with new tests. > > Note: This involves a small behavior change, as can be seen in > dblSpinner_testWrapAround_decrement_twoSteps() in SpinnerTest.java:749. With > this change the wrap