Skip to content

Fix #5069: null-guard layered pane parent in InteractionDialog popup#5070

Merged
shai-almog merged 1 commit into
masterfrom
fix-5069-interactiondialog-popup-npe
May 29, 2026
Merged

Fix #5069: null-guard layered pane parent in InteractionDialog popup#5070
shai-almog merged 1 commit into
masterfrom
fix-5069-interactiondialog-popup-npe

Conversation

@shai-almog
Copy link
Copy Markdown
Collaborator

Summary

Fixes #5069. InteractionDialog.showPopupDialogImpl was dereferencing getLayeredPane(f).getParent() to size the popup against the available area:

int availableHeight = getLayeredPane(f).getParent().getHeight();
...
int availableWidth = getLayeredPane(f).getParent().getWidth();

That parent can be momentarily null — e.g. when a previous formMode InteractionDialog was just disposed: cleanupLayer calls c.remove() on the inner FormLayer container, detaching it from formLayeredPane while a form animation may still be in flight, and the next popup can see the intermediate state. The reporter hit this on 7.0.244 with a chained dismiss-then-show flow involving formMode dialogs.

The fix grabs the parent once, treats null the same way the existing code already treats a zero getHeight()/getWidth(), and falls back to the display dimensions. No behavior change in the common path.

Test plan

  • mvn -pl core -am compile -DskipTests (JDK 8) — clean build.
  • User to confirm the NPE no longer fires in their reproduction (the issue notes it isn't reproducible in isolation outside the reporter's app).

🤖 Generated with Claude Code

showPopupDialogImpl dereferenced getLayeredPane(f).getParent() twice when
sizing the popup. The parent can be transiently null when a prior formMode
InteractionDialog was just disposed -- cleanupLayer detaches the inner
FormLayer container from its parent and the next popup can observe the
intermediate state before the form is fully relaid out. Treat a null
parent like a zero-sized one and fall back to the display dimensions
(matching the existing fallback for getHeight()/getWidth() == 0).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@shai-almog shai-almog force-pushed the fix-5069-interactiondialog-popup-npe branch from c2838dc to 4679373 Compare May 29, 2026 02:33
@github-actions
Copy link
Copy Markdown
Contributor

Cloudflare Preview

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 29, 2026

✅ 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 shai-almog merged commit 26d5969 into master May 29, 2026
18 checks passed
@shai-almog
Copy link
Copy Markdown
Collaborator Author

shai-almog commented May 29, 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% (1445/33836), complexity 5.30% (1723/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% (1445/33836), complexity 5.30% (1723/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 688.000 ms
Base64 CN1 encode 118.000 ms
Base64 encode ratio (CN1/native) 0.172x (82.8% faster)
Base64 native decode 651.000 ms
Base64 CN1 decode 275.000 ms
Base64 decode ratio (CN1/native) 0.422x (57.8% faster)
Image encode benchmark status skipped (SIMD unsupported)

@shai-almog
Copy link
Copy Markdown
Collaborator Author

shai-almog commented May 29, 2026

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

Benchmark Results

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

Build and Run Timing

Metric Duration
Simulator Boot 104000 ms
Simulator Boot (Run) 1000 ms
App Install 19000 ms
App Launch 11000 ms
Test Execution 355000 ms

Detailed Performance Metrics

Metric Duration
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 native encode 952.000 ms
Base64 CN1 encode 1717.000 ms
Base64 encode ratio (CN1/native) 1.804x (80.4% slower)
Base64 native decode 507.000 ms
Base64 CN1 decode 1416.000 ms
Base64 decode ratio (CN1/native) 2.793x (179.3% slower)
Base64 SIMD encode 623.000 ms
Base64 encode ratio (SIMD/native) 0.654x (34.6% faster)
Base64 encode ratio (SIMD/CN1) 0.363x (63.7% faster)
Base64 SIMD decode 579.000 ms
Base64 decode ratio (SIMD/native) 1.142x (14.2% slower)
Base64 decode ratio (SIMD/CN1) 0.409x (59.1% faster)
Image encode benchmark iterations 100
Image createMask (SIMD off) 84.000 ms
Image createMask (SIMD on) 13.000 ms
Image createMask ratio (SIMD on/off) 0.155x (84.5% faster)
Image applyMask (SIMD off) 309.000 ms
Image applyMask (SIMD on) 135.000 ms
Image applyMask ratio (SIMD on/off) 0.437x (56.3% faster)
Image modifyAlpha (SIMD off) 224.000 ms
Image modifyAlpha (SIMD on) 83.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.371x (62.9% faster)
Image modifyAlpha removeColor (SIMD off) 188.000 ms
Image modifyAlpha removeColor (SIMD on) 151.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 0.803x (19.7% faster)
Image PNG encode (SIMD off) 1508.000 ms
Image PNG encode (SIMD on) 1191.000 ms
Image PNG encode ratio (SIMD on/off) 0.790x (21.0% faster)
Image JPEG encode 551.000 ms

@shai-almog
Copy link
Copy Markdown
Collaborator Author

shai-almog commented May 29, 2026

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

Benchmark Results

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

Build and Run Timing

Metric Duration
Simulator Boot 81000 ms
Simulator Boot (Run) 1000 ms
App Install 15000 ms
App Launch 8000 ms
Test Execution 325000 ms

Detailed Performance Metrics

Metric Duration
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 native encode 822.000 ms
Base64 CN1 encode 2126.000 ms
Base64 encode ratio (CN1/native) 2.586x (158.6% slower)
Base64 native decode 455.000 ms
Base64 CN1 decode 1679.000 ms
Base64 decode ratio (CN1/native) 3.690x (269.0% slower)
Base64 SIMD encode 594.000 ms
Base64 encode ratio (SIMD/native) 0.723x (27.7% faster)
Base64 encode ratio (SIMD/CN1) 0.279x (72.1% faster)
Base64 SIMD decode 549.000 ms
Base64 decode ratio (SIMD/native) 1.207x (20.7% slower)
Base64 decode ratio (SIMD/CN1) 0.327x (67.3% faster)
Image encode benchmark iterations 100
Image createMask (SIMD off) 74.000 ms
Image createMask (SIMD on) 19.000 ms
Image createMask ratio (SIMD on/off) 0.257x (74.3% faster)
Image applyMask (SIMD off) 215.000 ms
Image applyMask (SIMD on) 131.000 ms
Image applyMask ratio (SIMD on/off) 0.609x (39.1% faster)
Image modifyAlpha (SIMD off) 277.000 ms
Image modifyAlpha (SIMD on) 156.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.563x (43.7% faster)
Image modifyAlpha removeColor (SIMD off) 333.000 ms
Image modifyAlpha removeColor (SIMD on) 116.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 0.348x (65.2% faster)
Image PNG encode (SIMD off) 1864.000 ms
Image PNG encode (SIMD on) 2539.000 ms
Image PNG encode ratio (SIMD on/off) 1.362x (36.2% slower)
Image JPEG encode 851.000 ms

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: NPE in showPopupDialogImpl(Rectangle rect, boolean bias) due getParent() of layeredPane returning null

1 participant