Skip to content

InteractionDialog: NPE in showPopupDialogImpl(Rectangle rect, boolean bias) due getParent() of layeredPane returning null #5069

@ThomasH99

Description

@ThomasH99

In 7.0.244, I get an NPE inside showPopupDialogImpl(Rectangle rect, boolean bias) in the line int availableHeight = getLayeredPane(f).getParent().getHeight(); due getParent() returning null. StackTrace below.

I can't figure out why the layeredPane should have a null parent. At least inside Form.getFormLayeredPane(Class c, boolean top) it seems the formLayeredPane should always be added to a parent container.

However, inside InteractionDialog.cleanupLayer(Form f) the layeredPane is removed from it's parent but not nulled in the Form, so that might be the reason. But the logic around the InteractionDialog is pretty complex, so I may be missing something.

So far, I haven't been able to reproduce it outside my app, but it may be due to another InteractionDialog in formMode being disposed of just before in case that's a hint.

java.lang.NullPointerException
	at com.codename1.components.InteractionDialog.showPopupDialogImpl(InteractionDialog.java:785)
	at com.codename1.components.InteractionDialog.showPopupDialog(InteractionDialog.java:697)
	at com.codename1.components.InteractionDialog.showPopupDialog(InteractionDialog.java:686)
	at com.myApp.myApp.DemoStep.show(DemoStep.java:1584)
	at com.myApp.myApp.DemoScenario.exitCurrentStepAndShowNextStepIfPossible(DemoScenario.java:767)
	at com.myApp.myApp.DemoStep.lambda$buildDemoStep$15(DemoStep.java:1234)
	at com.codename1.ui.Command$2.actionPerformed(Command.java:156)
	at com.codename1.ui.util.EventDispatcher.fireActionEvent(EventDispatcher.java:313)
	at com.codename1.ui.Button.fireActionEvent(Button.java:703)
	at com.codename1.ui.Button.released(Button.java:749)
	at com.codename1.ui.Button.pointerReleased(Button.java:841)
	at com.codename1.ui.LeadUtil.pointerReleased(LeadUtil.java:171)
	at com.codename1.ui.Form.pointerReleased(Form.java:3796)
	at com.myApp.myApp.MyForm.pointerReleased(MyForm.java:10575)
	at com.codename1.ui.Component.pointerReleased(Component.java:5758)
	at com.codename1.ui.Display.handleEvent(Display.java:2354)
	at com.codename1.ui.Display.edtLoopImpl(Display.java:1188)
	at com.codename1.ui.Display.mainEDTLoop(Display.java:1078)
	at com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:139)
	at com.codename1.impl.CodenameOneThread.run(CodenameOneThread.java:179)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions