santoshko / codenameone

Automatically exported from code.google.com/p/codenameone
0 stars 0 forks source link

TextArea: frozen/exception #798

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I have a problem with TextArea. The behaviour is "occasional" but I'm able to 
reproduce it. There are two cases:
1. when I write quickly sometimes it throws exception (see stack trace below)
2. when text exceeds displayed rows of TA (starts scrolling up) and I click 
into area between soft-keyboard and dialog (see test code below) keyboard 
disappears (it's OK) but sometimes application freezes (see screenshot attached)

I'm testing on Android 4.1.2 (Sony Xperia SP), 4.2.2. (Google Nexus 7)

Test code (just copy it into button's action listener):

Container noteCont = new Container(new BoxLayout(BoxLayout.Y_AXIS));

        TextArea ta = new TextArea();
        ta.setGrowByContent(true);
        ta.setSingleLineTextArea(false);
        ta.setRows(5);
        ta.setColumns(50);
        ta.setMaxSize(8000);

        noteCont.addComponent(ta);  

        Dialog dlg = new Dialog("Note");
        dlg.placeButtonCommands(new Command[]{new Command("OK")});
        dlg.addComponent(noteCont);     
        dlg.setBackCommand(new Command("Cancel"));
        dlg.showDialog();

Stack trace:
[EDT] 0:0:21,641 - java.lang.NullPointerException
[EDT] 0:0:21,658 - java.lang.NullPointerException
    at com.codename1.ui.TextArea.initRowString(TextArea.java:954)
    at com.codename1.ui.TextArea.getRowStrings(TextArea.java:667)
    at com.codename1.ui.TextArea.getLines(TextArea.java:681)
    at com.codename1.ui.plaf.DefaultLookAndFeel.getTextAreaSize(DefaultLookAndFeel.java:860)
    at com.codename1.ui.TextArea.calcScrollSize(TextArea.java:1023)
    at com.codename1.ui.Component.getScrollDimension(Component.java:542)
    at com.codename1.ui.TextArea.isScrollableY(TextArea.java:521)
    at com.codename1.ui.Component.isScrollable(Component.java:1373)
    at com.codename1.ui.Component.internalPaintImpl(Component.java:995)
    at com.codename1.ui.Component.paintInternalImpl(Component.java:984)
    at com.codename1.ui.Component.paintInternal(Component.java:967)
    at com.codename1.ui.Component.paintInternal(Component.java:935)
    at com.codename1.ui.Component.paintComponent(Component.java:1202)
    at com.codename1.ui.Component.paintComponent(Component.java:1154)
    at com.codename1.impl.CodenameOneImplementation.paintDirty(CodenameOneImplementation.java:370)
    at com.codename1.ui.Display.edtLoopImpl(Display.java:917)
    at com.codename1.ui.Display.invokeAndBlock(Display.java:1048)
    at com.codename1.ui.Display.invokeAndBlock(Display.java:1083)
    at com.codename1.impl.android.InPlaceEditView.waitForEditCompletion(InPlaceEditView.java:344)
    at com.codename1.impl.android.InPlaceEditView.edit(InPlaceEditView.java:465)
    at com.codename1.impl.android.AndroidImplementation.editString(AndroidImplementation.java:410)
    at com.codename1.ui.Display.editString(Display.java:1352)
    at com.codename1.ui.Display.editString(Display.java:1323)
    at com.codename1.ui.TextArea.editString(TextArea.java:541)
    at com.codename1.ui.TextArea.pointerReleased(TextArea.java:574)
    at com.codename1.ui.Form.pointerReleased(Form.java:2129)
    at com.codename1.ui.Dialog.pointerReleased(Dialog.java:1680)
    at com.codename1.ui.Component.pointerReleased(Component.java:2241)
    at com.codename1.ui.Display.handleEvent(Display.java:1709)
    at com.codename1.ui.Display.edtLoopImpl(Display.java:913)
    at com.codename1.ui.Display.invokeAndBlock(Display.java:1048)
    at com.codename1.ui.Display.invokeAndBlock(Display.java:1083)
    at com.codename1.ui.Form.showModal(Form.java:1398)
    at com.codename1.ui.Dialog.showModal(Dialog.java:1074)
    at com.codename1.ui.Dialog.show(Dialog.java:465)
    at com.codename1.ui.Dialog.showPackedImpl(Dialog.java:1351)
    at com.codename1.ui.Dialog.showPacked(Dialog.java:1262)
    at com.codename1.ui.Dialog.showImpl(Dialog.java:1034)
    at com.codename1.ui.Dialog.show(Dialog.java:1016)
    at com.codename1.ui.Dialog.showDialog(Dialog.java:1413)
    at userclasses.StateMachine.onMain_ButtonAction(StateMachine.java:61)
    at generated.StateMachineBase.handleComponentAction(StateMachineBase.java:320)
    at com.codename1.ui.util.UIBuilder$FormListener.actionPerformed(UIBuilder.java:2628)
    at com.codename1.ui.util.EventDispatcher.fireActionSync(EventDispatcher.java:383)
    at com.codename1.ui.util.EventDispatcher.fireActionEvent(EventDispatcher.java:326)
    at com.codename1.ui.Button.fireActionEvent(Button.java:376)
    at com.codename1.ui.Button.released(Button.java:407)
    at com.codename1.ui.Button.pointerReleased(Button.java:495)
    at com.codename1.ui.Form.pointerReleased(Form.java:2129)
    at com.codename1.ui.Form.pointerReleased(Form.java:2076)
    at com.codename1.ui.Component.pointerReleased(Component.java:2241)
    at com.codename1.ui.Display.handleEvent(Display.java:1709)
    at com.codename1.ui.Display.edtLoopImpl(Display.java:913)
    at com.codename1.ui.Display.mainEDTLoop(Display.java:858)
    at com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:119)
    at com.codename1.impl.CodenameOneThread$1.run(CodenameOneThread.java:60)
    at java.lang.Thread.run(Thread.java:856)

refs: 
https://groups.google.com/forum/#!topic/codenameone-discussions/2ON3u91xkOU

Original issue reported on code.google.com by ivan.ila...@gmail.com on 23 Jul 2013 at 7:34

Attachments:

GoogleCodeExporter commented 9 years ago
Chen committed a fix for this to SVN and I just uploaded it to the server. Can 
you please check that this fix indeed solved the issue?
Thanks.

Original comment by shai.almog on 23 Jul 2013 at 10:26