Re: [External] : Re: Q: Labeled.textTruncated Property (RFE)

2024-03-08 Thread Daniel Peintner
Andy, Marius, all,

Thank you for your input and your insights.

If I understand correctly we cannot purely do it with public methods for
now (at least not for TableCells)

This makes the argument to support https://github.com/openjdk/jfx/pull/1389
even stronger and maybe should be mentioned in the PR as well.

Thanks,

-- Daniel



On Thu, Mar 7, 2024 at 7:53 PM Andy Goryachev 
wrote:

> Daniel:
>
>
>
> Thank you for providing a sample app!
>
>
>
> You are right: turns out Labeled in a TableView (in a TreeTableView as
> well) lives by different rules (TableCellSkinBase:152,
> TreeTableCellSkin:126).
>
>
>
> The consequence of this is that the new functionality **cannot** be fully
> implemented with the public APIs alone.
>
>
>
> Cheers,
>
> -andy
>
>
>
>
>
>
>
> *From: *Daniel Peintner 
> *Date: *Thursday, March 7, 2024 at 07:11
> *To: *Andy Goryachev 
> *Cc: *openjfx-dev@openjdk.org 
> *Subject: *Re: [External] : Re: Q: Labeled.textTruncated Property (RFE)
>
> Andy, all,
>
> Some comments below:
>
>1. Even if it is possible to do the same with public means I think it
>is useful. Anyhow we need to promote the solutions better (e.g., on
>StackOverflow)
>2. I tried to achieve what you did in JavaFX core for my use-case,
>TableView cells.
>
>
>1. In my real application I tried and failed since the boolean
>   condition in
>   
> https://github.com/openjdk/jfx/blob/8a5cb17ed6525b0a218595865ead3e399e3b29dd/modules/javafx.controls/src/main/java/javafx/scene/control/Labeled.java#L838-L841
>   
> <https://urldefense.com/v3/__https:/github.com/openjdk/jfx/blob/8a5cb17ed6525b0a218595865ead3e399e3b29dd/modules/javafx.controls/src/main/java/javafx/scene/control/Labeled.java*L838-L841__;Iw!!ACWV5N9M2RV99hQ!O5PIY6RzCkXt8IZB_cJDcwbbQtpWdIn_eD5UALkoKFCGeCJeVYBBfkTd4q6zuLXtArNITv6DWEHxlHfs3Gv6skap9isYa3A$>
>   always reports false
>   2. Hence I tried to create a short self-contained TableView example
>   to explore it further, see Gist
>   https://gist.github.com/danielpeintner/9b561eb57261e8c5bc608f1346df74cf
>   
> <https://urldefense.com/v3/__https:/gist.github.com/danielpeintner/9b561eb57261e8c5bc608f1346df74cf__;!!ACWV5N9M2RV99hQ!O5PIY6RzCkXt8IZB_cJDcwbbQtpWdIn_eD5UALkoKFCGeCJeVYBBfkTd4q6zuLXtArNITv6DWEHxlHfs3Gv6skapYpmRbZI$>
>   It still fails :-(
>   3. The Email field in the table ideally should report "true" once
>   the text entered exceeds the visible view. Somehow it fails... 
> getWidth()
>   and  prefWidth(-1) always return the same double value. Please try the 
> Gist
>   above to confirm.
>   e.g., edit cell and extend the email text to longer than column
>   width --> results in System.out "Table-Email-Cell !isWrapText: 182.0 <
>   182.0 --> false"
>   4. Hence I also added a *normal* MyLabel example which does work as
>   intended
>
> Maybe I miss something obvious but TableCells seem to be special Labeled
> instances and behave differently.
>
>
>
> Thanks,
>
>
>
> -- Daniel
>
>
>
> [1] https://stackoverflow.com/a/52432862
> <https://urldefense.com/v3/__https:/stackoverflow.com/a/52432862__;!!ACWV5N9M2RV99hQ!O5PIY6RzCkXt8IZB_cJDcwbbQtpWdIn_eD5UALkoKFCGeCJeVYBBfkTd4q6zuLXtArNITv6DWEHxlHfs3Gv6skappYtR2cY$>
>
>
>
>
>
> On Wed, Mar 6, 2024 at 6:10 PM Andy Goryachev 
> wrote:
>
> Dear Daniel:
>
>
>
> Thank you for confirming the need for this enhancement.  Your case is
> covered by this ticket (I included a wrong ticket in my previous message by
> mistake, sorry):
>
>
>
> JDK-8327483 <https://bugs.openjdk.org/browse/JDK-8327483> TreeView: Allow
> for tooltip when cell text is truncated
>
>
>
> My only concern is that this functionality theoretically can be achieved
> by the application code just as easy, since the solution does not use any
> internal APIs, as can be seen here:
> https://github.com/openjdk/jfx/pull/1389
> <https://urldefense.com/v3/__https:/github.com/openjdk/jfx/pull/1389__;!!ACWV5N9M2RV99hQ!LUwCrjMEKxlGC0k5v9-zO0Axw6TqddmMJM7_6onFdHOLL1eo5MDNu1lVj7grGquhgJdnqXX_eCyA7MGEMNyIivVMcBB9XfY$>
>
>
>
> -andy
>
>
>
>
>
> *From: *Daniel Peintner 
> *Date: *Tuesday, March 5, 2024 at 23:53
> *To: *Andy Goryachev 
> *Cc: *openjfx-dev@openjdk.org 
> *Subject: *[External] : Re: Q: Labeled.textTruncated Property (RFE)
>
> Hi Andy, all,
>
>
>
> Thank you for the effort which I very much appreciate.
>
> We have a similar use-case as the one mentioned in JDK-8205211.
>
>
>
> We would like to show a Tooltip with the corresponding text once th

Re: [External] : Re: Q: Labeled.textTruncated Property (RFE)

2024-03-07 Thread Daniel Peintner
Andy, all,

Some comments below:


   1. Even if it is possible to do the same with public means I think it is
   useful. Anyhow we need to promote the solutions better (e.g., on
   StackOverflow)

   2. I tried to achieve what you did in JavaFX core for my use-case,
   TableView cells.
  1. In my real application I tried and failed since the boolean
  condition in
  
https://github.com/openjdk/jfx/blob/8a5cb17ed6525b0a218595865ead3e399e3b29dd/modules/javafx.controls/src/main/java/javafx/scene/control/Labeled.java#L838-L841
  always reports false
  2. Hence I tried to create a short self-contained TableView example
  to explore it further, see Gist
  https://gist.github.com/danielpeintner/9b561eb57261e8c5bc608f1346df74cf
  It still fails :-(
  3. The Email field in the table ideally should report "true" once the
  text entered exceeds the visible view. Somehow it fails... getWidth() and
   prefWidth(-1) always return the same double value. Please try the Gist
  above to confirm.
  e.g., edit cell and extend the email text to longer than column width
  --> results in System.out "Table-Email-Cell !isWrapText: 182.0 <
182.0 -->
  false"
  4. Hence I also added a *normal* MyLabel example which does work as
  intended

Maybe I miss something obvious but TableCells seem to be special Labeled
instances and behave differently.

Thanks,

-- Daniel

[1] https://stackoverflow.com/a/52432862


On Wed, Mar 6, 2024 at 6:10 PM Andy Goryachev 
wrote:

> Dear Daniel:
>
>
>
> Thank you for confirming the need for this enhancement.  Your case is
> covered by this ticket (I included a wrong ticket in my previous message by
> mistake, sorry):
>
>
>
> JDK-8327483 <https://bugs.openjdk.org/browse/JDK-8327483> TreeView: Allow
> for tooltip when cell text is truncated
>
>
>
> My only concern is that this functionality theoretically can be achieved
> by the application code just as easy, since the solution does not use any
> internal APIs, as can be seen here:
> https://github.com/openjdk/jfx/pull/1389
> <https://urldefense.com/v3/__https:/github.com/openjdk/jfx/pull/1389__;!!ACWV5N9M2RV99hQ!LUwCrjMEKxlGC0k5v9-zO0Axw6TqddmMJM7_6onFdHOLL1eo5MDNu1lVj7grGquhgJdnqXX_eCyA7MGEMNyIivVMcBB9XfY$>
>
>
>
> -andy
>
>
>
>
>
> *From: *Daniel Peintner 
> *Date: *Tuesday, March 5, 2024 at 23:53
> *To: *Andy Goryachev 
> *Cc: *openjfx-dev@openjdk.org 
> *Subject: *[External] : Re: Q: Labeled.textTruncated Property (RFE)
>
> Hi Andy, all,
>
>
>
> Thank you for the effort which I very much appreciate.
>
> We have a similar use-case as the one mentioned in JDK-8205211.
>
>
>
> We would like to show a Tooltip with the corresponding text once the text
> is shown with ellipsis for a TableCell. The *hacky* solution we are using
> is sketched in [1] and requires us to calculate the width again. Moreover,
> once different fonts come into the game it becomes even more brittle.
>
>
>
> Having an easy (easier?) way to detect and observe whether a label is
> truncated is of importance for us and definitely improves the usability of
> JavaFX.
>
>
>
> Thanks,
>
>
>
> -- Daniel
>
>
>
> [1] https://stackoverflow.com/a/52432862
> <https://urldefense.com/v3/__https:/stackoverflow.com/a/52432862__;!!ACWV5N9M2RV99hQ!LUwCrjMEKxlGC0k5v9-zO0Axw6TqddmMJM7_6onFdHOLL1eo5MDNu1lVj7grGquhgJdnqXX_eCyA7MGEMNyIivVMSbAOrZg$>
>
>
>
> On Tue, Mar 5, 2024 at 10:15 PM Andy Goryachev 
> wrote:
>
> Dear colleagues:
>
>
>
> Do you think a new property, *ReadOnlyBooleanProperty textTruncated*,
> should be added to the Labeled control?
>
>
>
>
>
> On one hand, we do have a couple of tickets in JBS requesting that:
>
>
>
>- JDK-8091891 <https://bugs.openjdk.org/browse/JDK-8091891> TreeView:
>There is no tooltip available on truncated node
>- JDK-8205211 <https://bugs.openjdk.org/browse/JDK-8205211> Ability to
>show Tooltip only when text is shown with ellipsis (...)
>
>
>
> On the other hand, this functionality can in theory be implemented at the
> application level, although the number of changes required might be
> uncomfortably large in the case of Tree/TreeTable/TableView.
>
>
>
> JBS:
>
>- JDK-8092102 <https://bugs.openjdk.org/browse/JDK-8092102> Labeled:
>truncated property
>
>
>
> Pull Request: https://github.com/openjdk/jfx/pull/1389
> <https://urldefense.com/v3/__https:/github.com/openjdk/jfx/pull/1389__;!!ACWV5N9M2RV99hQ!LUwCrjMEKxlGC0k5v9-zO0Axw6TqddmMJM7_6onFdHOLL1eo5MDNu1lVj7grGquhgJdnqXX_eCyA7MGEMNyIivVMcBB9XfY$>
>
>
>
> What do you think?
>
>
>
> -andy
>
>


Re: Q: Labeled.textTruncated Property (RFE)

2024-03-05 Thread Daniel Peintner
Hi Andy, all,

Thank you for the effort which I very much appreciate.
We have a similar use-case as the one mentioned in JDK-8205211.

We would like to show a Tooltip with the corresponding text once the text
is shown with ellipsis for a TableCell. The *hacky* solution we are using
is sketched in [1] and requires us to calculate the width again. Moreover,
once different fonts come into the game it becomes even more brittle.

Having an easy (easier?) way to detect and observe whether a label is
truncated is of importance for us and definitely improves the usability of
JavaFX.

Thanks,

-- Daniel

[1] https://stackoverflow.com/a/52432862

On Tue, Mar 5, 2024 at 10:15 PM Andy Goryachev 
wrote:

> Dear colleagues:
>
>
>
> Do you think a new property, *ReadOnlyBooleanProperty textTruncated*,
> should be added to the Labeled control?
>
>
>
>
>
> On one hand, we do have a couple of tickets in JBS requesting that:
>
>
>
>- JDK-8091891  TreeView:
>There is no tooltip available on truncated node
>- JDK-8205211  Ability to
>show Tooltip only when text is shown with ellipsis (...)
>
>
>
> On the other hand, this functionality can in theory be implemented at the
> application level, although the number of changes required might be
> uncomfortably large in the case of Tree/TreeTable/TableView.
>
>
>
> JBS:
>
>- JDK-8092102  Labeled:
>truncated property
>
>
>
> Pull Request: https://github.com/openjdk/jfx/pull/1389
>
>
>
> What do you think?
>
>
>
> -andy
>


Re: [External] : Re: Proposal: RichTextArea Control (Incubator)

2024-02-23 Thread Daniel Peintner
Dear Andy, others,

Thank you for your feedback. Yes, having a one-line TextArea, mocking up a
TextField, that contains a longer text with some sub-strings being able to
style is enough for my use-case.

Anyhow, I agree with others that having the possibility to "style" parts of
other controls like Label, TextField, etc would be very astonishing. This
might introduce a lot of complexity, I guess.

Having said that, this would offer a unique selling point and go beyond
what other external libraries did. Anyhow, this would most probably
facilitate such work in the future.

Best,

-- Daniel


On Thu, Feb 22, 2024 at 5:29 PM Andy Goryachev 
wrote:

> Dear Daniel:
>
>
>
> Thank you for your kind words!
>
>
>
> Re: StyledTextArea/TextField.
>
>
>
> This is a very interesting question.  It is definitely out of scope right
> now, but we can certainly talk about it.
>
>
>
> One major difference between the new control and the regular
> TextField/TextArea is that we add a separate rich text model, while
> TextField/Area expose a String 'text' property.  We could think of using
> the same model, or constructing some kind of StyledDocument, but in any
> case it won't be a drop-in replacement for TextField/TextArea.
>
>
>
> The other aspect is the visuals.  Whereas a StyledTextArea might require
> the same kinds of surrounding toolbars and controls to function as a
> useable editor (font, style, color, etc.), how would a StyledTextField look?
>
>
>
> At the same time, it is possible to easily configure RichTextArea to look
> like a styled text area or one-line styled text field.  It is also possible
> that another use case exists which requires a dedicated control?
>
>
>
>
>
> Re: spell checker.
>
>
>
> Yes, there is a way to add a "squiggly line", see here:
>
>
> https://github.com/andy-goryachev-oracle/Test/blob/rich.jep.review/doc/RichTextArea/RichTextArea.md#creating-a-paragraph
>
>
>
> At this moment, this functionality is not a part of any standard model,
> but is certainly possible.
>
>
>
> It might be also possible to add a similar functionality to the regular
> TextField/TextArea using public APIs, simply by adding a "squiggly" line
> shape over the standard control.  Just a thought.
>
>
>
> What do you think?
>
>
>
> -andy
>
>
>
>
>
>
>
> *From: *Daniel Peintner 
> *Date: *Thursday, February 22, 2024 at 03:07
> *To: *Andy Goryachev 
> *Cc: *openjfx-dev@openjdk.org 
> *Subject: *[External] : Re: Proposal: RichTextArea Control (Incubator)
>
> Hi Andy, others,
>
>
>
> I highly appreciate and welcome the effort of a built-in RichTextArea .
>
>
>
> A question that popped up in my mind is whether this work might include
> work in the area of *rich* TextField also? Probably it is out of scope.
> Anyhow, JavaFX Textfields are used in even more areas in UI controls like
> in tables etc and having the possibility to style them would be similarly
> convincing.
>
>
>
> As you might know, some alternative *external* solutions like RichTextFX
> do provide next to StyleClassedTextArea also StyleClassedTextField.
>
>
>
> Anyway, thank you very very much for the continuous development.
>
>
>
> Sincerely,
>
>
>
> -- Daniel
>
>
>
> P.S: Maybe just one line about the use case I have in mind. We do offer
> (based on RichTextFX) the ability to do "spell checking" on text (like you
> know from all word processors). A red underline shows a possible mistake
> and a ContextMenu offers fixes. This red line is therefore needed for text
> in TextArea but also for text in TextField
>
>
>
>
>
> On Wed, Feb 21, 2024 at 7:07 PM Andy Goryachev 
> wrote:
>
> Dear JavaFX developers:
>
>
>
> We would like to propose a new feature - rich text control, RichTextArea,
> intended to bridge the functional gap with Swing and its
> StyledEditorKit/JEditorPane.  The main design goal is to provide a control
> that is complete enough to be useful out-of-the box, as well as open to
> extension by the application developers.
>
>
>
> This is a complex feature with a large API surface that would be nearly
> impossible to get right the first time, even after an extensive review.  We
> are, therefore, introducing this in an incubating module,
> *javafx.incubator.richtext*.   This will allow us to evolve the API in
> future releases without the strict compatibility constraints that other
> JavaFX modules have.
>
>
>
> Please take a look at the proposal [0], a list of discussion points [1],
> and the API Specification (javadoc) [2]. While the proposed API is ready
> for r

Re: Proposal: RichTextArea Control (Incubator)

2024-02-22 Thread Daniel Peintner
Hi Andy, others,

I highly appreciate and welcome the effort of a built-in RichTextArea .

A question that popped up in my mind is whether this work might include
work in the area of *rich* TextField also? Probably it is out of scope.
Anyhow, JavaFX Textfields are used in even more areas in UI controls like
in tables etc and having the possibility to style them would be similarly
convincing.

As you might know, some alternative *external* solutions like RichTextFX do
provide next to StyleClassedTextArea also StyleClassedTextField.

Anyway, thank you very very much for the continuous development.

Sincerely,

-- Daniel

P.S: Maybe just one line about the use case I have in mind. We do offer
(based on RichTextFX) the ability to do "spell checking" on text (like you
know from all word processors). A red underline shows a possible mistake
and a ContextMenu offers fixes. This red line is therefore needed for text
in TextArea but also for text in TextField


On Wed, Feb 21, 2024 at 7:07 PM Andy Goryachev 
wrote:

> Dear JavaFX developers:
>
>
>
> We would like to propose a new feature - rich text control, RichTextArea,
> intended to bridge the functional gap with Swing and its
> StyledEditorKit/JEditorPane.  The main design goal is to provide a control
> that is complete enough to be useful out-of-the box, as well as open to
> extension by the application developers.
>
>
>
> This is a complex feature with a large API surface that would be nearly
> impossible to get right the first time, even after an extensive review.  We
> are, therefore, introducing this in an incubating module,
> *javafx.incubator.richtext*.   This will allow us to evolve the API in
> future releases without the strict compatibility constraints that other
> JavaFX modules have.
>
>
>
> Please take a look at the proposal [0], a list of discussion points [1],
> and the API Specification (javadoc) [2]. While the proposed API is ready
> for review, it isn't complete nor set in stone. We are looking for
> feedback, and will update the proposal based on the suggestions we receive
> from the community.  We encourage you to comment either in the mailing
> list, or by leaving comments inline in a draft pull request [3].  For
> context, the links to the original RFE [4] and a list of missing APIs
> related to rich text [5] are provided below.
>
>
>
> Sincerely,
>
> Your friendly JavaFX development team.
>
>
>
>
>
> References
>
>
>
>
>
> [0] Proposal:
> https://github.com/andy-goryachev-oracle/Test/blob/rich.jep.review/doc/RichTextArea/RichTextArea.md
>
> [1] Discussion points:
> https://github.com/andy-goryachev-oracle/Test/blob/rich.jep.review/doc/RichTextArea/RichTextAreaDiscussion.md
>
> [2] API specification (javadoc):
> https://cr.openjdk.org/~angorya/RichTextArea/javadoc
>
> [3] Draft Pull Request for API comments and feedback:
> https://github.com/openjdk/jfx/pull/1374
>
> [4] RichTextArea RFE: https://bugs.openjdk.org/browse/JDK-8301121
>
> [5] Missing APIs related to rich text control:
> https://bugs.openjdk.org/browse/JDK-8300569
>
>
>


Re: JavaFX 19-ea+11 Crashes

2022-09-15 Thread Daniel Peintner
Hi,

In March 2022 we were experiencing some random crashes after upgrading to
JavaFX 18 (see [1]). In the end it didn't have to do with JavaFX but with
Java HotSpot.
I created a bug report [2] which was later closed as a duplicate of
JDK-8275610 (see [3]).

By now (Java18) it should be fixed.
Note: I cannot confirm this, since we are still stuck with Java17.

Which Java version are you using?
Maybe upgrading helps and the issue is related.

IF you need to stick with Java17 (not sure if it gets backported or how I
can check this) you may want to try disabling C2 optimization.

-XX:+TieredCompilation   (enable C1)
-XX:TieredStopAtLevel=1 (disable C2)

I hope this helps,

-- Daniel

[1] https://mail.openjdk.org/pipermail/openjfx-dev/2022-March/033831.html
[2] https://bugs.openjdk.org/browse/JDK-8283386
[3] https://bugs.openjdk.org/browse/JDK-8275610

On Wed, Sep 14, 2022 at 10:58 PM Kevin Rushforth 
wrote:

> That looks like a HotSpot crash. Have you tried running with JDK 18 or
> JDK 19 (which is in RC)?
>
> -- Kevin
>
> On 9/14/2022 1:38 PM, Thiago Milczarek Sayão wrote:
> > Hi,
> >
> > Anybody experiencing crashes with javafx 19-ea+11?
> >
> > I have replaced it with javafx 19 final to test.
> >
> > By the look of the log, it has something to do with the garbage
> > collector and MenuButtonSkinBase .
> >
> > I have suppressed some parts.
> >
> > # A fatal error has been detected by the Java Runtime Environment:
> > #
> > #  SIGSEGV (0xb) at pc=0x7f4547fbd31f, pid=133481, tid=133520
> > #
> > # JRE version: OpenJDK Runtime Environment (17.0.4+8) (build
> > 17.0.4+8-Ubuntu-120.04)
> > # Java VM: OpenJDK 64-Bit Server VM (17.0.4+8-Ubuntu-120.04, mixed
> > mode, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
> > # Problematic frame:
> > # V  [libjvm.so+0x59931f]
> >  ClassLoaderData::ChunkedHandleList::oops_do(OopClosure*)+0x5f
> >
> > ---  S U M M A R Y 
> >
> > Command Line: -Xmx350m -Xms135m -Djava.net.preferIPv4Stack=true
> > -Dsun.awt.disablegrab=true
> >
> --add-modules=javafx.controls,javafx.fxml,javafx.web,javafx.swing,javafx.media
>
> > fl.jar
> >
> > Host: Intel(R) Core(TM) i3-10100 CPU @ 3.60GHz, 8 cores, 7G, Ubuntu
> > 20.04.4 LTS
> > Time: Wed Sep 14 17:18:28 2022 -03 elapsed time: 47.851666 seconds (0d
> > 0h 0m 47s)
> >
> > ---  T H R E A D  ---
> >
> > Current thread (0x7f450c00d690):  GCTaskThread "GC Thread#6"
> > [stack: 0x7f44b1bc7000,0x7f44b1cc7000] [id=133520]
> >
> > Stack: [0x7f44b1bc7000,0x7f44b1cc7000],
> >  sp=0x7f44b1cc5ac0,  free space=1018k
> > Native frames: (J=compiled Java code, j=interpreted, Vv=VM code,
> > C=native code)
> > V  [libjvm.so+0x59931f]
> >  ClassLoaderData::ChunkedHandleList::oops_do(OopClosure*)+0x5f
> > V  [libjvm.so+0x7476ad]  G1CLDScanClosure::do_cld(ClassLoaderData*)+0x3d
> > V  [libjvm.so+0x59e351]
> >  ClassLoaderDataGraph::roots_cld_do(CLDClosure*, CLDClosure*)+0x41
> > V  [libjvm.so+0x76f1bc]
> >  G1RootProcessor::process_java_roots(G1RootClosures*, G1GCPhaseTimes*,
> > unsigned int)+0xcc
> > V  [libjvm.so+0x76f835]
> >  G1RootProcessor::evacuate_roots(G1ParScanThreadState*, unsigned
> int)+0x65
> > V  [libjvm.so+0x705b16]
> >  G1EvacuateRegionsTask::scan_roots(G1ParScanThreadState*, unsigned
> > int)+0x26
> > V  [libjvm.so+0x7062b7]  G1EvacuateRegionsBaseTask::work(unsigned
> > int)+0x87
> > V  [libjvm.so+0xf8e907]  GangWorker::loop()+0x67
> > V  [libjvm.so+0xf8e963]
> > V  [libjvm.so+0xedbe42]  Thread::call_run()+0xe2
> > V  [libjvm.so+0xc324f9]  thread_native_entry(Thread*)+0xe9
> >
> >
> > RAX=0x007a is an unknown value
> > RBX=0x7f44a53f26f8 points into unknown readable memory:
> > 0x0001 | 01 00 00 00 00 00 00 00
> > RCX=0x0014 is an unknown value
> > RDX=0x31e6 is an unknown value
> > RSP=0x7f44b1cc5ac0 points into unknown readable memory:
> > 0x7f4488003ac8 | c8 3a 00 88 44 7f 00 00
> > RBP=0x7f44b1cc5ae0 points into unknown readable memory:
> > 0x7f44b1cc5b20 | 20 5b cc b1 44 7f 00 00
> > RSI=0xf6110495 is pointing into object: java.lang.Class
> > {0xf6110468} - klass: 'java/lang/Class'
> >  -  fields (total size 14 words):
> >  - private volatile transient 'classRedefinedCount' 'I' @12  0
> >  - private volatile transient 'cachedConstructor'
> > 'Ljava/lang/reflect/Constructor;' @40  NULL (0)
> >  - private transient 'name' 'Ljava/lang/String;' @44
> >
>  
> "javafx.scene.control.skin.MenuButtonSkinBase$$Lambda$2420/0x000100ff7248"{0xf4078820}
>
> > (f4078820)
> >  - private transient 'module' 'Ljava/lang/Module;' @48  a
> > 'java/lang/Module'{0xea298020} (ea298020)
> >  - private final 'classLoader' 'Ljava/lang/ClassLoader;' @52  a
> > 'jdk/internal/loader/ClassLoaders$AppClassLoader'{0xea975708}
> > (ea975708)
> >  - private transient 'classData' 'Ljava/lang/Object;' @56  NULL (0)
> >  - private transient 'packageName' 

Re: [External] : Re: ConcurrentModificationException when calling stage.show()

2022-09-09 Thread Daniel Peintner
All,

Thanks for the confirmation.

I am currently trying to come up with a standalone test-case. Unfortunately
I failed to do so (so far). In the simple case the issue does not show up.
I will try further and file a bug report once I succeed.

-- Daniel




On Thu, Sep 8, 2022 at 2:26 PM Kevin Rushforth 
wrote:

> Presuming that you aren't calling initialize directly from some other
> thread, and aren't concurrently accessing the menu from some other thread,
> I agree that adding a runLater shouldn't be needed. So yes, this does seem
> like our bug. Can you file a bug report at https://bugreport.java.com/
> with a complete standalone test case?
>
> -- Kevin
>
> On 9/7/2022 11:57 PM, Daniel Peintner wrote:
>
> Hi Kevin, all,
>
> I investigated further and I think I found the problem (or at least a
> solution).
>
> In my application I use FXML+Controller approach.
>
> The issue I described arises if in controller.initialize(...).
> I update the menu-items of a menu. In my case, the menu list is empty in
> FXML and while initializing I update the menu with the "recently" opened
> files so that people can restart their work with files they opened before.
>
> The solution that works in my case is to wrap these menu updates in
> Platform.runLater() even though I think this should not be needed. Am I
> right?
>
> public class MyLayoutController extends BorderPane implements
> Initializable {
> @Override
> public void initialize(URL location, ResourceBundle resources) {
> // updating the menu updates within runLater() does not cause
> ConcurrentModificationException
> Platform.runLater(() -> {
>// anyhow, I think this should not be needed
>this.menu.getItems().add(new MenuItem("A"));
>this.menu.getItems().add(new MenuItem("B"));
>this.menu.getItems().add(new MenuItem("C"));
> });
> }
> }
>
> Is this sufficient to create a bug report?
>
> Thanks,
>
> -- Daniel
>
>
>
>
> On Mon, Sep 5, 2022 at 7:47 PM Kevin Rushforth 
> wrote:
>
>> I suspect a JavaFX bug, unless there some other thread not shown in your
>> stack trace that is modifying any object in the now-live scene graph.
>>
>> -- Kevin
>>
>>
>> On 9/5/2022 6:34 AM, Daniel Peintner wrote:
>> > All,
>> >
>> > I have a strange issue popping up once in a while.
>> > I have an application (FXML+ Controller) that has a "new" button
>> > opening a new window. In 99% percent of the cases this works just fine.
>> >
>> > In some rare cases though, stage.show() fails due to a
>> > ConcurrentModificationException. Since this issue does not happen in
>> > my code but rather in JavaFX code I wanted to ask whether there is a
>> > specific prerequisite I am not aware of or whether this is a bug in
>> > JavaFX.
>> >
>> > Attached the stack trace. Unfortunately I am not able to create a
>> > reproducible example that fails always.
>> >
>> > I am grateful for any tip.
>> >
>> > Thanks,
>> >
>> > -- Daniel
>> >
>> >
>> > Exception in thread "JavaFX Application Thread"
>> > java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
>> > at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1857)
>> > at
>> >
>> javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1724)
>> > at
>> >
>> com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
>> > at
>> >
>> com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:234)
>> > at
>> >
>> com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
>> > at
>> >
>> com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
>> > at
>> >
>> com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
>> > at
>> >
>> com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
>> > at
>> >
>> com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
>> > at
>> >
>> com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
>> > at
>> >
>> com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:

Re: ConcurrentModificationException when calling stage.show()

2022-09-08 Thread Daniel Peintner
Hi Kevin, all,

I investigated further and I think I found the problem (or at least a
solution).

In my application I use FXML+Controller approach.

The issue I described arises if in controller.initialize(...).
I update the menu-items of a menu. In my case, the menu list is empty in
FXML and while initializing I update the menu with the "recently" opened
files so that people can restart their work with files they opened before.

The solution that works in my case is to wrap these menu updates in
Platform.runLater() even though I think this should not be needed. Am I
right?

public class MyLayoutController extends BorderPane implements Initializable
{
@Override
public void initialize(URL location, ResourceBundle resources) {
// updating the menu updates within runLater() does not cause
ConcurrentModificationException
Platform.runLater(() -> {
   // anyhow, I think this should not be needed
   this.menu.getItems().add(new MenuItem("A"));
   this.menu.getItems().add(new MenuItem("B"));
   this.menu.getItems().add(new MenuItem("C"));
});
}
}

Is this sufficient to create a bug report?

Thanks,

-- Daniel




On Mon, Sep 5, 2022 at 7:47 PM Kevin Rushforth 
wrote:

> I suspect a JavaFX bug, unless there some other thread not shown in your
> stack trace that is modifying any object in the now-live scene graph.
>
> -- Kevin
>
>
> On 9/5/2022 6:34 AM, Daniel Peintner wrote:
> > All,
> >
> > I have a strange issue popping up once in a while.
> > I have an application (FXML+ Controller) that has a "new" button
> > opening a new window. In 99% percent of the cases this works just fine.
> >
> > In some rare cases though, stage.show() fails due to a
> > ConcurrentModificationException. Since this issue does not happen in
> > my code but rather in JavaFX code I wanted to ask whether there is a
> > specific prerequisite I am not aware of or whether this is a bug in
> > JavaFX.
> >
> > Attached the stack trace. Unfortunately I am not able to create a
> > reproducible example that fails always.
> >
> > I am grateful for any tip.
> >
> > Thanks,
> >
> > -- Daniel
> >
> >
> > Exception in thread "JavaFX Application Thread"
> > java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
> > at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1857)
> > at
> >
> javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1724)
> > at
> >
> com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
> > at
> >
> com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:234)
> > at
> >
> com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
> > at
> >
> com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
> > at
> >
> com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
> > at
> >
> com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
> > at
> >
> com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
> > at
> >
> com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
> > at
> >
> com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
> > at
> >
> com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
> > at
> >
> com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
> > at
> >
> com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
> > at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
> > at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
> > at javafx.event.Event.fireEvent(Event.java:198)
> > at javafx.scene.Node.fireEvent(Node.java:8797)
> > at javafx.scene.control.Button.fire(Button.java:203)
> > at
> >
> com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:208)
> > at
> > com.sun.javafx.scene.control.inputmap.InputMap.handle(InputMap.java:274)
> > at
> >
> com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:247)
> > at
> >
> com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
> > at

ConcurrentModificationException when calling stage.show()

2022-09-05 Thread Daniel Peintner
All,

I have a strange issue popping up once in a while.
I have an application (FXML+ Controller) that has a "new" button opening a
new window. In 99% percent of the cases this works just fine.

In some rare cases though, stage.show() fails due to a
ConcurrentModificationException. Since this issue does not happen in my
code but rather in JavaFX code I wanted to ask whether there is a specific
prerequisite I am not aware of or whether this is a bug in JavaFX.

Attached the stack trace. Unfortunately I am not able to create a
reproducible example that fails always.

I am grateful for any tip.

Thanks,

-- Daniel


Exception in thread "JavaFX Application Thread" java.lang.RuntimeException:
java.lang.reflect.InvocationTargetException
at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1857)
at
javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1724)
at
com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
at
com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:234)
at
com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at
com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at
com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at
com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at
com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at
com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at
com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at
com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at
com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at
com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
at javafx.event.Event.fireEvent(Event.java:198)
at javafx.scene.Node.fireEvent(Node.java:8797)
at javafx.scene.control.Button.fire(Button.java:203)
at
com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:208)
at com.sun.javafx.scene.control.inputmap.InputMap.handle(InputMap.java:274)
at
com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:247)
at
com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
at
com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:234)
at
com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at
com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at
com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at
com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at
com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at
com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at
com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at
com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at
com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at
com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
at javafx.event.Event.fireEvent(Event.java:198)
at javafx.scene.Scene$MouseHandler.process(Scene.java:3881)
at javafx.scene.Scene.processMouseEvent(Scene.java:1874)
at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2607)
at
com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:411)
at
com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:301)
at
java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at
com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(GlassViewEventHandler.java:450)
at
com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:424)
at
com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:449)
at com.sun.glass.ui.View.handleMouseEvent(View.java:551)
at com.sun.glass.ui.View.notifyMouse(View.java:937)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at
com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:184)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused