From 53da3cc026e0e12de6461123f092e5113ee01b7a Mon Sep 17 00:00:00 2001 From: Maurizio Cimadamore Date: Wed, 4 Oct 2023 11:49:22 +0100 Subject: [PATCH] Restore TWR --- .../share/classes/sun/font/HBShaper.java | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/java.desktop/share/classes/sun/font/HBShaper.java b/src/java.desktop/share/classes/sun/font/HBShaper.java index 0028fddababd2..7058c63327b51 100644 --- a/src/java.desktop/share/classes/sun/font/HBShaper.java +++ b/src/java.desktop/share/classes/sun/font/HBShaper.java @@ -445,7 +445,7 @@ static void shape( ScopedValue.where(scopedVars, vars) .run(() -> { - Arena arena = Arena.ofConfined(); + try (Arena arena = Arena.ofConfined()) { float startX = (float)startPt.getX(); float startY = (float)startPt.getY(); @@ -455,18 +455,15 @@ static void shape( MemorySegment chars = arena.allocateArray(JAVA_CHAR, text.length); MemorySegment.copy(text, 0, chars, JAVA_CHAR, 0, text.length); - try { - /*int ret =*/ - jdk_hb_shape_handle.invokeExact( - ptSize, matrix, hbface, chars, text.length, - script, offset, limit, - baseIndex, startX, startY, flags, slot, - font_funcs_pointer, - store_layout_results_stub); - } catch (Throwable ex) { - ex.printStackTrace(); - } - arena.close(); + /*int ret =*/ jdk_hb_shape_handle.invokeExact( + ptSize, matrix, hbface, chars, text.length, + script, offset, limit, + baseIndex, startX, startY, flags, slot, + font_funcs_pointer, + store_layout_results_stub); + } catch (Throwable t) { + t.printStackTrace(); + } }); }