Skip to content
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

[android] fixing the length of array out of memory #17136

Closed
wants to merge 2 commits into from

Conversation

colorfulberry
Copy link

@colorfulberry colorfulberry commented Dec 11, 2017

Motivation

check the index, if the index equal or grater than the array, use the array last element

Test Plan

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work. Bonus points for screenshots and videos!)

Related PRs

(If this PR adds or changes functionality, please take some time to update the docs at https://github.com/facebook/react-native-website, and link to your PR here.)

Release Notes

[ANDROID] [BUGFIX] [zIndex] leads the array length out of memeory
the crash logs is


Last Exception Backtrace
--
0 | java.lang.ArrayIndexOutOfBoundsException: length=1; index=1
1 | at com.facebook.react.uimanager.ViewGroupDrawingOrderHelper.getChildDrawingOrder(ViewGroupDrawingOrderHelper.java:101)
2 | at com.facebook.react.views.view.ReactViewGroup.getChildDrawingOrder(ReactViewGroup.java:410)
3 | at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3530)
4 | at android.view.View.updateDisplayListIfDirty(View.java:15380)
5 | at android.view.View.draw(View.java:16189)
6 | at android.view.ViewGroup.drawChild(ViewGroup.java:3750)
7 | at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3534)
8 | at android.view.View.draw(View.java:16447)
9 | at android.widget.HorizontalScrollView.draw(HorizontalScrollView.java:1628)
10 | at com.facebook.react.views.scroll.ReactHorizontalScrollView.draw(ReactHorizontalScrollView.java:251)
11 | at android.view.View.updateDisplayListIfDirty(View.java:15388)
12 | at android.view.View.draw(View.java:16189)
13 | at android.view.ViewGroup.drawChild(ViewGroup.java:3750)
14 | at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3534)
15 | at android.view.View.updateDisplayListIfDirty(View.java:15380)
16 | at android.view.View.draw(View.java:16189)
17 | at android.view.ViewGroup.drawChild(ViewGroup.java:3750)
18 | at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3534)
19 | at android.view.View.draw(View.java:16447)
20 | at android.widget.HorizontalScrollView.draw(HorizontalScrollView.java:1628)
21 | at com.facebook.react.views.scroll.ReactHorizontalScrollView.draw(ReactHorizontalScrollView.java:251)
22 | at android.view.View.updateDisplayListIfDirty(View.java:15388)
23 | at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3734)
24 | at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3714)
25 | at android.view.View.updateDisplayListIfDirty(View.java:15339)
26 | at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3734)
27 | at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3714)
28 | at android.view.View.updateDisplayListIfDirty(View.java:15339)
29 | at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3734)
30 | at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3714)
31 | at android.view.View.updateDisplayListIfDirty(View.java:15339)
32 | at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3734)
33 | at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3714)
34 | at android.view.View.updateDisplayListIfDirty(View.java:15339)
35 | at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3734)
36 | at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3714)
37 | at android.view.View.updateDisplayListIfDirty(View.java:15339)
38 | at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3734)
39 | at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3714)
40 | at android.view.View.updateDisplayListIfDirty(View.java:15339)
41 | at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3734)
42 | at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3714)
43 | at android.view.View.updateDisplayListIfDirty(View.java:15339)
44 | at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3734)
45 | at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3714)
46 | at android.view.View.updateDisplayListIfDirty(View.java:15339)
47 | at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3734)
48 | at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3714)
49 | at android.view.View.updateDisplayListIfDirty(View.java:15339)
50 | at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:286)
51 | at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:292)
52 | at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:327)
53 | at android.view.ViewRootImpl.draw(ViewRootImpl.java:3030)
54 | at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2834)
55 | at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2446)
56 | at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1323)
57 | at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6734)
58 | at android.view.Choreographer$CallbackRecord.run(Choreographer.java:894)
59 | at android.view.Choreographer.doCallbacks(Choreographer.java:696)
60 | at android.view.Choreographer.doFrame(Choreographer.java:631)
61 | at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:880)
62 | at android.os.Handler.handleCallback(Handler.java:815)
63 | at android.os.Handler.dispatchMessage(Handler.java:104)
64 | at android.os.Looper.loop(Looper.java:207)
65 | at android.app.ActivityThread.main(ActivityThread.java:5896)
66 | at java.lang.reflect.Method.invoke(Native Method)
67 | at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
68 | at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)



@facebook-github-bot
Copy link
Contributor

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@colorfulberry colorfulberry changed the title fixing fixing the length of array out of memory [android] fixing the length of array out of memory Dec 11, 2017
@facebook-github-bot
Copy link
Contributor

@colorfulberry I tried to find reviewers for this pull request and wanted to ping them to take another look. However, based on the blame information for the files in this pull request I couldn't find any reviewers. This sometimes happens when the files in the pull request are new or don't exist on master anymore. Is this pull request still relevant? If yes could you please rebase? In case you know who has context on this code feel free to mention them in a comment (one person is fine). Thanks for reading and hope you will continue contributing to the project.

@react-native-bot
Copy link
Collaborator

Thanks for sending this pull request! We would love to review your changes however it looks like you haven't signed the CLA yet.

If you are still interested in supporting this PR, please sign the CLA by visiting https://code.facebook.com/cla. Let us know once you have done so.

facebook-github-bot pushed a commit that referenced this pull request Nov 19, 2019
Summary:
Changelog: [General][Changed] - React sync for revisions 0b61e2698...6cff70a74 (Includes React 16.11.0)

This sync includes the following changes:
- **[6cff70a74](facebook/react@6cff70a74 )**: [react-interactions]
Expost host instance to Scope Query function (#17341) //<Dominic Gannaway>//
- **[b8f825877](facebook/react@b8f825877 )**: Split ReactDOM entry
point (#17331) //<Dan Abramov>//
- **[a7b4d51a2](facebook/react@a7b4d51a2 )**: Warn when doing creat
eRoot twice on the same node (another approach) (#17329) //<Dan Abramov>//
- **[be3bfa6fa](facebook/react@be3bfa6fa )**: [Flight] Basic Integr
ation Test (#17307) //<Dan Abramov>//
- **[6cb6b1d66](facebook/react@6cb6b1d66 )**: Add yarn build --unsa
fe-partial (#17316) //<Dan Abramov>//
- **[38dd17ab9](facebook/react@38dd17ab9 )**: [RN] Hoist static dee
pDiffer options object (#17303) //<Moti Zilberman>//
- **[61d3dd0e0](facebook/react@61d3dd0e0 )**: Update deepDiffer usa
ge in React Native renderer (#17282) //<Moti Zilberman>//
- **[e701632ad](facebook/react@e701632ad )**: [react-interactions] Change unmount blur logic to a dedicated event (#17291) //<Dominic Gannaway>//
- **[ce4b3e998](facebook/react@ce4b3e998 )**: [react-interactions] Add optional searchNodes to Scope.queryAllNodes (#17293) //<Dominic Gannaway>//
- **[dee03049f](facebook/react@dee03049f )**: [Flight] Basic Streaming Suspense Support (#17285) //<Sebastian Markbåge>//
- **[f50f39b55](facebook/react@f50f39b55 )**: [Flight] Better compat with http.createServer (#17289) //<Dan Abramov>//
- **[345270630](facebook/react@345270630 )**: DevTools cleanup (#17283) //<Brian Vaughn>//
- **[cd1bdcd06](facebook/react@cd1bdcd06 )**: [react-interactions] Prevent duplicate onPress firing for keyboard Enter (#17266) //<Dominic Gannaway>//
- **[4f02c93c7](facebook/react@4f02c93c7 )**: Fix devtools displaying Anonymous for memo of ref-forwarding components (#17274) //<Waseem Dahman>//
- **[053cf0fed](facebook/react@053cf0fed )**: Fix react-is memo and lazy type checks (#17278) //<Brian Vaughn>//
- **[0f3838a01](facebook/react@0f3838a01 )**: Remove `debugRenderPhaseSideEffects` flag (#17270) //<Andrew Clark>//
- **[cb09dbe0a](facebook/react@cb09dbe0a )**: [react-interactions] Add handleSimulateChildBlur upon DOM node removal (#17225) //<Dominic Gannaway>//
- **[6095993d4](facebook/react@6095993d4 )**: Types: findHostInstance_DEPRECATED returns React.ElementRef<HostComponent<mixed>> (#17265) //<Eli White>//
- **[62ef25077](facebook/react@62ef25077 )**: Avoid bundling in ponyfill for Object.assign in use-subscription package (#17259) //<Mateusz Burzyński>//
- **[f4148b256](facebook/react@f4148b256 )**: [Flight] Move around the Server side a bit (#17251) //<Sebastian Markbåge>//
- **[fadc97167](facebook/react@fadc97167 )**: [Flight] Add Client Infrastructure (#17234) //<Sebastian Markbåge>//
- **[36fd29f09](facebook/react@36fd29f09 )**: Don't show empty (no work) commits in Profiler (#17253) //<Brian Vaughn>//
- **[a2e05b6c1](facebook/react@a2e05b6c1 )**: [Scheduler] Delete old rAF implementation (#17252) //<Andrew Clark>//
- **[6dc2734b4](facebook/react@6dc2734b4 )**: Codemod tests to `it.experimental` (#17243) //<Andrew Clark>//
- **[273679a78](facebook/react@273679a78 )**: DevTools standalone shell changes: (#17213) //<Brian Vaughn>//
- **[d0fc0ba0a](facebook/react@d0fc0ba0a )**: Revert "Dispatch commands to both UIManagers from both renderers (#17211)" (#17232) //<Eli White>//
- **[bdcdb69a2](facebook/react@bdcdb69a2 )**: Rename findHostInstance_deprecated to findHostInstance_DEPRECATED (#17228) //<Eli White>//
- **[515746c21](facebook/react@515746c21 )**: Add findHostInstance_deprecated to the React Native Renderer (#17224) //<Eli White>//
- **[9a35adc96](facebook/react@9a35adc96 )**: Only call Profiler onRender when a descendant had work (#17223) //<Brian Vaughn>//
- **[8eee0eb01](facebook/react@8eee0eb01 )**: Dispatch commands to both UIManagers from both renderers (#17211) //<Eli White>//
- **[f4e974d26](facebook/react@f4e974d26 )**: Add Experimental Flight Infrastructure (#16398) //<Sebastian Markbåge>//
- **[6cd365cac](facebook/react@6cd365cac )**: Don't treat the last row in hidden as deleted if already mounted (#17206) //<Sebastian Markbåge>//
- **[048879eda](facebook/react@048879eda )**: [react-interactions] Ensure props on scope query function is always object (#17212) //<Dominic Gannaway>//
- **[3497ccc14](facebook/react@3497ccc14 )**: Add guard to handle modified React elements with non-string keys (#17164) //<Brian Vaughn>//
- **[3f9c03675](facebook/react@3f9c03675 )**: Typo fix in comment (#17111) //<Deniz Susman>//
- **[f6b8d31a7](facebook/react@f6b8d31a7 )**: Rename createSyncRoot to createBlockingRoot (#17165) //<Dan Abramov>//
- **[9c02d2654](facebook/react@9c02d2654 )**: docs: Fixed a typo in readme.md (#17119) //<Wilco Fiers>//
- **[8075c8505](facebook/react@8075c8505 )**: Update local package versions for 16.10 release //<Andrew Clark>//
- **[5faf377df](facebook/react@5faf377df )**: Fixed a style bug in props editor (#17162) //<Brian Vaughn>//
- **[f7ec65eeb](facebook/react@f7ec65eeb )**: [react-interactions] Make events non-passive to allow preventDefault (#17136) //<Dominic Gannaway>//
- **[1022ee0ec](facebook/react@1022ee0ec )**: Read current time without marking event start time (#17160) //<Andrew Clark>//
- **[349cf5acc](facebook/react@349cf5acc )**: Experimental test helper: `it.experimental` (#17149) //<Andrew Clark>//
- **[edc234c73](facebook/react@edc234c73 )**: Build script should default to experimental (#17144) //<Andrew Clark>//
- **[3cc564547](facebook/react@3cc564547 )**: SuspenseList support in DevTools (#17145) //<Sebastian Markbåge>//
- **[68fb58029](facebook/react@68fb58029 )**: Remove unstable_ prefix in various internal uses (#17146) //<Sebastian Markbåge>//
- **[7082d5a2d](facebook/react@7082d5a2d )**: Don't build non-experimental www bundles (#17139) //<Andrew Clark>//
- **[c47f59331](facebook/react@c47f59331 )**: Move SuspenseList to experimental package (#17130) //<Andrew Clark>//
- **[685ed561f](facebook/react@685ed561f )**: Migrate useDeferredValue and useTransition (#17058) //<Luna Ruan>//
- **[0b61e2698](facebook/react@0b61e2698 )**: Update RN typings for a shim (#17138) //<Dan Abramov>//

Reviewed By: threepointone

Differential Revision: D18428149

fbshipit-source-id: 28273be4d7a4c7ec0fe0451cea134ee09a3b4d86
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.

3 participants