On Thu, 11 Jun 2020 19:25:07 GMT, Kevin Rushforth <[email protected]> wrote:

>> I think I see what you are trying to do, but there are a couple of problems 
>> it is causing. I attached a new test program to the JBS bug report, 
>> UnicodeTextTest2.java, which avoids any null (0) characters. That test runs 
>> fine today, and with the first version of your fix (the one without the 
>> Map), but causes assertion failures with the current version of the patch:
>> 
>> 
>> (java:32761): Pango-CRITICAL **: 10:37:09.535: pango_itemize: assertion 
>> 'length >= 0' failed
>> 
>> (java:32761): Pango-CRITICAL **: 10:37:09.963: pango_itemize: assertion 
>> 'length >= 0' failed
>> 
>> 
>> I also sometimes get this:
>> 
>> 
>> #
>> # A fatal error has been detected by the Java Runtime Environment:
>> #
>> #  SIGSEGV (0xb) at pc=0x00007f00456c2d78, pid=32761, tid=32778
>> #
>> # JRE version: Java(TM) SE Runtime Environment (14.0+36) (build 14+36-1461)
>> # Java VM: Java HotSpot(TM) 64-Bit Server VM (14+36-1461, mixed mode, 
>> sharing, tiered, compressed oops, serial gc, linux-amd64)
>> # Problematic frame:
>> # C  [libglib-2.0.so.0+0x84d78]  g_utf8_offset_to_pointer+0x28
>> 
>> 
>> Phil is the expert here, so I'd like him to weigh in.
>
> Given my observation with the `start` pointer, I think the `HashMap` as you 
> are using it is fine. Do you think a `LinkedHashMap` might be useful to 
> preserve the iteration order? (since you only iterate it once in `dispose` it 
> probably doesn't matter).

I think this map has introduced a bug that has gone unnoticed. The assumption 
that TextRun's are not mutated doesn't seem to hold (there is TextRun.split 
which predates this change).

Also I think that this map doesn't buy us a lot, it really is only used once 
AFAICS and sometimes a 2nd time (which is causing bugs as that map should have 
been invalidated after a mutation).

So why was this map introduced? Also this is worrying me:

> That test runs fine today, and with the first version of your fix (the one 
> without the Map)

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/249#discussion_r4694072586

Reply via email to