Skip to content

Fix #5067: InteractionDialog dispose leaves dialog visible without animateShow#5068

Merged
shai-almog merged 1 commit into
masterfrom
fix-5067-interaction-dialog-dispose
May 29, 2026
Merged

Fix #5067: InteractionDialog dispose leaves dialog visible without animateShow#5068
shai-almog merged 1 commit into
masterfrom
fix-5067-interaction-dialog-dispose

Conversation

@shai-almog
Copy link
Copy Markdown
Collaborator

Summary

  • InteractionDialog.dispose() left the dialog visible on screen when setAnimateShow(false) + setFormMode(true). Scrolling or hovering would make it disappear, but the dialog otherwise stayed painted until the next external repaint trigger.
  • Trigger a form-level revalidate at the end of dispose() so the next paint cycle reliably clears the old dialog pixels.
  • Add a regression test (disposeWithoutAnimationSchedulesFormRepaint) in InteractionDialogTest.

Root cause

dispose() ends with:

Container pp = getLayeredPane(f);
remove();                    // <-- triggers recursive deinitialize()
...
pp.revalidate();             // <-- relies on pp's parent chain to reach the form
cleanupLayer(f);

The remove() invokes Component.deinitializeImpl()InteractionDialog.deinitialize(), which already runs its own cleanupLayer(f) and detaches the layered-pane wrapper (pp) from the form. By the time the outer pp.revalidate() runs, pp.getComponentForm() returns null, so revalidateInternal falls through Container.java:1606 and never calls Form.repaint().

setAnimateShow(true) masked the bug because animateUnlayoutAndWait(...) drives its own paint cycle.

Fix

After cleanupLayer(f), call f.revalidateWithAnimationSafety(). This guarantees a form revalidate + repaint regardless of whether the layered-pane wrapper is still attached when the earlier pp.revalidate() runs.

Regression test

The test instantiates a RepaintCountingForm, shows it, opens the dialog with the exact animateShow=false + formMode=true flags from the bug report, resets the counter, calls dispose(), and asserts repaint() was invoked at least once. The test fails on master (0 calls) and passes with this fix (1 call).

Note: the test requires form.show() (rather than just implementation.setCurrentForm(form)) so the dialog actually initialises -- without initialisation, the recursive deinitialize() path doesn't fire and dispose() hits a different (working) code path that masks the bug.

Test plan

  • mvn -pl core-unittests -am test -Dtest=InteractionDialogTest -DunitTests — all 10 tests pass
  • Full core-unittests suite (mvn -pl core-unittests -am test -DunitTests) — 2634 tests pass
  • Verified the new test fails on master (observed 0 calls) and passes with the fix

🤖 Generated with Claude Code

…imateShow

dispose() called remove() then pp.revalidate() on the layered pane wrapper to schedule
the form repaint that hides the old dialog pixels. But remove() triggers the recursive
deinitialize() path which itself runs cleanupLayer() and detaches that wrapper from the
form first -- so by the time pp.revalidate() runs, pp has no Form in its parent chain and
the repaint never bubbles up. setAnimateShow(true) masked the bug because the animation
drives its own paint cycle. Without it, the old dialog pixels stayed on screen until
something else (scroll, hover) forced a redraw.

Force a form-level revalidate after cleanupLayer so the next paint cycle clears the
pixels deterministically.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

Cloudflare Preview

@github-actions
Copy link
Copy Markdown
Contributor

✅ Continuous Quality Report

Test & Coverage

Static Analysis

  • SpotBugs [Report archive]
    • ByteCodeTranslator: 0 findings (no issues)
    • android: 0 findings (no issues)
    • codenameone-maven-plugin: 0 findings (no issues)
    • core-unittests: 0 findings (no issues)
    • ios: 0 findings (no issues)
  • PMD: 0 findings (no issues) [Report archive]
  • Checkstyle: 0 findings (no issues) [Report archive]

Generated automatically by the PR CI workflow.

@shai-almog
Copy link
Copy Markdown
Collaborator Author

shai-almog commented May 28, 2026

Compared 115 screenshots: 115 matched.
✅ Native iOS screenshot tests passed.

Benchmark Results

  • VM Translation Time: 0 seconds
  • Compilation Time: 418 seconds

Build and Run Timing

Metric Duration
Simulator Boot 116000 ms
Simulator Boot (Run) 2000 ms
App Install 24000 ms
App Launch 18000 ms
Test Execution 428000 ms

Detailed Performance Metrics

Metric Duration
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 native encode 1310.000 ms
Base64 CN1 encode 2289.000 ms
Base64 encode ratio (CN1/native) 1.747x (74.7% slower)
Base64 native decode 731.000 ms
Base64 CN1 decode 1636.000 ms
Base64 decode ratio (CN1/native) 2.238x (123.8% slower)
Base64 SIMD encode 576.000 ms
Base64 encode ratio (SIMD/native) 0.440x (56.0% faster)
Base64 encode ratio (SIMD/CN1) 0.252x (74.8% faster)
Base64 SIMD decode 768.000 ms
Base64 decode ratio (SIMD/native) 1.051x (5.1% slower)
Base64 decode ratio (SIMD/CN1) 0.469x (53.1% faster)
Image encode benchmark iterations 100
Image createMask (SIMD off) 80.000 ms
Image createMask (SIMD on) 13.000 ms
Image createMask ratio (SIMD on/off) 0.163x (83.8% faster)
Image applyMask (SIMD off) 214.000 ms
Image applyMask (SIMD on) 122.000 ms
Image applyMask ratio (SIMD on/off) 0.570x (43.0% faster)
Image modifyAlpha (SIMD off) 269.000 ms
Image modifyAlpha (SIMD on) 91.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.338x (66.2% faster)
Image modifyAlpha removeColor (SIMD off) 218.000 ms
Image modifyAlpha removeColor (SIMD on) 136.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 0.624x (37.6% faster)
Image PNG encode (SIMD off) 1614.000 ms
Image PNG encode (SIMD on) 1271.000 ms
Image PNG encode ratio (SIMD on/off) 0.787x (21.3% faster)
Image JPEG encode 850.000 ms

@shai-almog
Copy link
Copy Markdown
Collaborator Author

shai-almog commented May 28, 2026

Compared 116 screenshots: 116 matched.

Native Android coverage

  • 📊 Line coverage: 12.45% (7217/57972 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 10.15% (36287/357360), branch 4.27% (1444/33836), complexity 5.30% (1722/32486), method 9.24% (1406/15210), class 15.16% (321/2117)
    • Lowest covered classes
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysKt – 0.00% (0/6327 lines covered)
      • kotlin.collections.unsigned.kotlin.collections.unsigned.UArraysKt___UArraysKt – 0.00% (0/2384 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.ClassReader – 0.00% (0/1519 lines covered)
      • kotlin.collections.kotlin.collections.CollectionsKt___CollectionsKt – 0.00% (0/1148 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.MethodWriter – 0.00% (0/923 lines covered)
      • kotlin.sequences.kotlin.sequences.SequencesKt___SequencesKt – 0.00% (0/730 lines covered)
      • kotlin.text.kotlin.text.StringsKt___StringsKt – 0.00% (0/623 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.Frame – 0.00% (0/564 lines covered)
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysJvmKt – 0.00% (0/495 lines covered)
      • kotlinx.coroutines.kotlinx.coroutines.JobSupport – 0.00% (0/423 lines covered)

✅ Native Android screenshot tests passed.

Native Android coverage

  • 📊 Line coverage: 12.45% (7217/57972 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 10.15% (36287/357360), branch 4.27% (1444/33836), complexity 5.30% (1722/32486), method 9.24% (1406/15210), class 15.16% (321/2117)
    • Lowest covered classes
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysKt – 0.00% (0/6327 lines covered)
      • kotlin.collections.unsigned.kotlin.collections.unsigned.UArraysKt___UArraysKt – 0.00% (0/2384 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.ClassReader – 0.00% (0/1519 lines covered)
      • kotlin.collections.kotlin.collections.CollectionsKt___CollectionsKt – 0.00% (0/1148 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.MethodWriter – 0.00% (0/923 lines covered)
      • kotlin.sequences.kotlin.sequences.SequencesKt___SequencesKt – 0.00% (0/730 lines covered)
      • kotlin.text.kotlin.text.StringsKt___StringsKt – 0.00% (0/623 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.Frame – 0.00% (0/564 lines covered)
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysJvmKt – 0.00% (0/495 lines covered)
      • kotlinx.coroutines.kotlinx.coroutines.JobSupport – 0.00% (0/423 lines covered)

Benchmark Results

Detailed Performance Metrics

Metric Duration
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 native encode 995.000 ms
Base64 CN1 encode 153.000 ms
Base64 encode ratio (CN1/native) 0.154x (84.6% faster)
Base64 native decode 879.000 ms
Base64 CN1 decode 197.000 ms
Base64 decode ratio (CN1/native) 0.224x (77.6% faster)
Image encode benchmark status skipped (SIMD unsupported)

@shai-almog
Copy link
Copy Markdown
Collaborator Author

shai-almog commented May 28, 2026

Compared 115 screenshots: 115 matched.
✅ Native iOS Metal screenshot tests passed.

Benchmark Results

  • VM Translation Time: 0 seconds
  • Compilation Time: 216 seconds

Build and Run Timing

Metric Duration
Simulator Boot 70000 ms
Simulator Boot (Run) 1000 ms
App Install 38000 ms
App Launch 36000 ms
Test Execution 317000 ms

Detailed Performance Metrics

Metric Duration
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 native encode 583.000 ms
Base64 CN1 encode 2144.000 ms
Base64 encode ratio (CN1/native) 3.678x (267.8% slower)
Base64 native decode 383.000 ms
Base64 CN1 decode 1623.000 ms
Base64 decode ratio (CN1/native) 4.238x (323.8% slower)
Base64 SIMD encode 535.000 ms
Base64 encode ratio (SIMD/native) 0.918x (8.2% faster)
Base64 encode ratio (SIMD/CN1) 0.250x (75.0% faster)
Base64 SIMD decode 582.000 ms
Base64 decode ratio (SIMD/native) 1.520x (52.0% slower)
Base64 decode ratio (SIMD/CN1) 0.359x (64.1% faster)
Image encode benchmark iterations 100
Image createMask (SIMD off) 100.000 ms
Image createMask (SIMD on) 12.000 ms
Image createMask ratio (SIMD on/off) 0.120x (88.0% faster)
Image applyMask (SIMD off) 198.000 ms
Image applyMask (SIMD on) 54.000 ms
Image applyMask ratio (SIMD on/off) 0.273x (72.7% faster)
Image modifyAlpha (SIMD off) 208.000 ms
Image modifyAlpha (SIMD on) 60.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.288x (71.2% faster)
Image modifyAlpha removeColor (SIMD off) 229.000 ms
Image modifyAlpha removeColor (SIMD on) 174.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 0.760x (24.0% faster)
Image PNG encode (SIMD off) 1094.000 ms
Image PNG encode (SIMD on) 942.000 ms
Image PNG encode ratio (SIMD on/off) 0.861x (13.9% faster)
Image JPEG encode 756.000 ms

@shai-almog shai-almog linked an issue May 29, 2026 that may be closed by this pull request
@shai-almog shai-almog merged commit 99c2baa into master May 29, 2026
25 of 28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

InteractionDialog: not reliably removed on dispose()

1 participant