Closed GoogleCodeExporter closed 9 years ago
Update after further testing, I have been able to get these npe's without
restarting my app (meaning I never left the app after initially starting it).
In several of the instances where I got these exceptions, right before I had a
bunch of the following NPE one after the other finally resulting in one of the
exceptions above.
09-08 21:20:32.111: E/Codename One(14453): Err on EDT
09-08 21:20:32.111: E/Codename One(14453): java.lang.NullPointerException
09-08 21:20:32.111: E/Codename One(14453): at
com.codename1.ui.Component.pointerDragged(Unknown Source)
09-08 21:20:32.111: E/Codename One(14453): at
com.codename1.ui.Form.pointerDragged(Unknown Source)
09-08 21:20:32.111: E/Codename One(14453): at
com.codename1.ui.Component.pointerDragged(Unknown Source)
09-08 21:20:32.111: E/Codename One(14453): at
com.codename1.ui.Display.handleEvent(Unknown Source)
09-08 21:20:32.111: E/Codename One(14453): at
com.codename1.ui.Display.edtLoopImpl(Unknown Source)
09-08 21:20:32.111: E/Codename One(14453): at
com.codename1.ui.Display.mainEDTLoop(Unknown Source)
09-08 21:20:32.111: E/Codename One(14453): at
com.codename1.ui.RunnableWrapper.run(Unknown Source)
09-08 21:20:32.111: E/Codename One(14453): at
com.codename1.impl.CodenameOneThread.run(Unknown Source)
Original comment by Ian.Te...@gmail.com
on 9 Sep 2012 at 2:27
I have been able to figure out exactly how to reproduce this exception. I have
Container with an empty Label as its only Component in CENTER position of a
BorderLayout. I them call Container.replace(getComponentAt(0),
myBrowserComponent, null). Before and during the replace, I make click and drag
motions on the screen in the container that the replace is taking place in. I
then get a lot of the NPE's in com.codename1.ui.Component.pointerDragged, then
finally the npe in android.webkit.WebView.requestFocus resulting in my app
crashing.
Original comment by Ian.Te...@gmail.com
on 9 Sep 2012 at 3:34
Assigning to Chen
Original comment by shai.almog
on 9 Sep 2012 at 4:33
Correction to my previous post, the Container.replace call uses a transition,
so it looks like this:
replace(getComponentAt(0), subclassOfWebBrowser,
UIManager.getInstance().getLookAndFeel().getDefaultFormTransitionOut());
Also, although I did not leave the app, I clicked on an ad inside of the
WebBrowser causing a url to executed using Display.execute, I hit back when the
"Complete action using" Android dialog appeared which caused the current form
with the WebBrowser to be denintialized and then initialized again. So it still
may be an issue with calling destroy on the WebView in
AndroidBrowserComponent.deinitialize.
Original comment by Ian.Te...@gmail.com
on 9 Sep 2012 at 3:00
Forgot to actually asign
Original comment by shai.almog
on 9 Sep 2012 at 4:28
Another update :)
The exception happens mostly when the the component being replaced (component
returned by getComponentAt(0)) is another WebBrowser, so I'm basically
replacing one WebBrowser with another.
I was able to work around this issue by not using Container.replace, but
instead forgetting about the transition and just calling removeAll and
addComponent manually on the Container. With this change have been unable to
reproduce the exception.
So my guess that there is something wrong in the Container.replace
transition/animation that allows pointer dragged events on the component being
removed - which in my case was a WebBrowser that is no longer valid.
Hope this helps and sorry about all of these updates.
Original comment by Ian.Te...@gmail.com
on 9 Sep 2012 at 10:22
added destory to the WebBrowser and removed the deinitalize from the peer
component.
I still would not recommend doing transitions with peer components
Original comment by cf27...@gmail.com
on 10 Sep 2012 at 9:20
Original comment by cf27...@gmail.com
on 10 Sep 2012 at 9:21
I think there are some errors in the last 2 revisions that you committed to fix
this.
First in r463, AndroidImplementation.browserDestroy calls stop() on the
AndroidBrowserComponent not destroy().
In r464, you did not add the destroy() method to the BrowserComponent class
that calls CodenameOneImplementation.browserDestroy, so WebBrowser.destroy
should be causing an error right now.
Original comment by Ian.Te...@gmail.com
on 10 Sep 2012 at 12:57
thanks, fixed the issues
Original comment by cf27...@gmail.com
on 10 Sep 2012 at 1:08
Original issue reported on code.google.com by
Ian.Te...@gmail.com
on 8 Sep 2012 at 8:32