-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TIMOB-14357] Android: TiViewProxy and TiCompositeLayout crashes due to NullPointerException #4415
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -510,6 +510,7 @@ protected void onLayout(boolean changed, int l, int t, int r, int b) | |
|
||
for (int i = 0; i < count; i++) { | ||
View child = getChildAt(i); | ||
if (child == null) continue; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why would a child be null here? If a child is null, it should be removed from the parent either in module land or JS land. This seems to be a workaround to the main problem. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, this is a fix for a symptom over the root cause. We don't have reproducable test cause but it seems is is crashing when we use Titanium views with complex layout. |
||
TiCompositeLayout.LayoutParams params = | ||
(TiCompositeLayout.LayoutParams) child.getLayoutParams(); | ||
if (child.getVisibility() != View.GONE) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the window can only be null if the activity is not visible. Are you sending "MSG_GETSIZE" anywhere in Lanica platform? This is only being used in getSize() of a view, so in our case the activity should be visible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually it is not related to Lanica's platform...it is solely happening inside Titanium views. Actually one of Lanica's component is using TiViewProxy but we are sure our component is not crashing because of this...it seems when we use Titanium views with complex layout it is crashing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I see. If this is indeed a platform problem, I think we'd need some reproducible code so we can track down and solve the core problem. I think our next step should be narrow down the UI component that causes this. If this is a TableView issue, we'd fix it in TableView, but putting an if statement in TiViewProxy seems more of a band-aid than an actual fix to me. Let me know if there's anything I can do to help.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hieupham007 . I am having the same issue with a complex view structure inside a TableViewRow.
I have View objects inside TableViewRow, which are again nested in each other.
But strangely enough, it works first time but when I try to load the view again(read: refresh), it crashes with the specified NPE i.e :
java.lang.NullPointerException
at org.appcelerator.titanium.view.TiCompositeLayout.onLayout(TiCompositeLayout.java:513)
at android.view.View.layout(View.java:14072)
at android.view.ViewGroup.layout(ViewGroup.java:4607)
at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
at android.view.View.layout(View.java:14072)
at android.view.ViewGroup.layout(ViewGroup.java:4607)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1655)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1513)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1426)
at android.view.View.layout(View.java:14072)
at android.view.ViewGroup.layout(ViewGroup.java:4607)
at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
at android.view.View.layout(View.java:14072)
at android.view.ViewGroup.layout(ViewGroup.java:4607)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:1997)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1818)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1115)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4526)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
at android.view.Choreographer.doCallbacks(Choreographer.java:555)
at android.view.Choreographer.doFrame(Choreographer.java:525)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4921)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
at dalvik.system.NativeStart.main(Native Method)
I am still digging in code to check if there's any problem w.r.t traversing all the nested views inside a TableViewRow, but then why do it worked the first time I load the view :-/ strange
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have the exact same stack trace and problem as @v1p, is it possbile to get a patch through for this or at least a work around? Right now it is crashing my app a lot.