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

Crash when trying to delete a word right before an image #798

Closed
mzorz opened this issue Mar 26, 2019 · 3 comments
Closed

Crash when trying to delete a word right before an image #798

mzorz opened this issue Mar 26, 2019 · 3 comments
Labels

Comments

@mzorz
Copy link
Contributor

mzorz commented Mar 26, 2019

Expected

Aztec please don't crash :)

Observed

When a word that is right before an image is selected and deleted, the editor crashes.

2019-03-26 15:18:59.282 25339-25339/org.wordpress.aztec E/AndroidRuntime: FATAL EXCEPTION: main
    Process: org.wordpress.aztec, PID: 25339
    java.lang.ArrayIndexOutOfBoundsException: length=39; index=-1
        at android.text.DynamicLayout.getBlockIndex(DynamicLayout.java:648)
        at android.widget.Editor.drawHardwareAccelerated(Editor.java:1703)
        at android.widget.Editor.onDraw(Editor.java:1672)
        at android.widget.TextView.onDraw(TextView.java:6882)
        at android.view.View.draw(View.java:19192)
        at android.view.View.updateDisplayListIfDirty(View.java:18142)
        at android.view.View.draw(View.java:18920)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4236)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4022)
        at android.view.View.updateDisplayListIfDirty(View.java:18133)
        at android.view.View.draw(View.java:18920)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4236)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4022)
        at android.view.View.draw(View.java:19195)
        at android.widget.ScrollView.draw(ScrollView.java:1739)
        at android.view.View.updateDisplayListIfDirty(View.java:18142)
        at android.view.View.draw(View.java:18920)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4236)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4022)
        at android.view.View.updateDisplayListIfDirty(View.java:18133)
        at android.view.View.draw(View.java:18920)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4236)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4022)
        at android.view.View.updateDisplayListIfDirty(View.java:18133)
        at android.view.View.draw(View.java:18920)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4236)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4022)
        at android.view.View.updateDisplayListIfDirty(View.java:18133)
        at android.view.View.draw(View.java:18920)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4236)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4022)
        at android.view.View.updateDisplayListIfDirty(View.java:18133)
        at android.view.View.draw(View.java:18920)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4236)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4022)
        at android.view.View.updateDisplayListIfDirty(View.java:18133)
        at android.view.View.draw(View.java:18920)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4236)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4022)
        at android.view.View.draw(View.java:19195)
        at com.android.internal.policy.DecorView.draw(DecorView.java:788)
        at android.view.View.updateDisplayListIfDirty(View.java:18142)
        at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:669)
        at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:675)
        at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:783)
        at android.view.ViewRootImpl.draw(ViewRootImpl.java:2992)
        at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2806)
        at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2359)
        at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1392)
        at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6752)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911)
        at android.view.Choreographer.doCallbacks(Choreographer.java:723)
        at android.view.Choreographer.doFrame(Choreographer.java:658)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897)
        at android.os.Handler.handleCallback(Handler.java:790)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6494)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
2019-03-26 15:18:59.283 25339-25339/org.wordpress.aztec E/WordPress-EDITOR: HTML content of Aztec Editor before the crash:
2019-03-26 15:18:59.288 25339-25339/org.wordpress.aztec E/WordPress-EDITOR: vjffjff Fufjf ffufu f[caption align="alignright"]<img src="https://examplebloge.files.wordpress.com/2017/02/3def4804-d9b5-11e6-88e6-d7d8864392e0.png" />Caption[/caption]<h1>Heading 1</h1><h2>Heading 2</h2><h3>Heading 3</h3><h4>Heading 4</h4><h5>Heading 5</h5><h6>Heading 6</h6><b>Bold</b><br><i style="color:darkred">Italic</i><br><u style="color:lime">Underline</u><br><s class="test" style="color:#ff666666">Strikethrough</s><ol style="color:green"><li>Ordered</li><li>should have color</li></ol><hr /><ul><li style="color:darkred">Unordered</li><li>Should not have color</li></ul><blockquote>Quote</blockquote><pre>when (person) {<br>MOCTEZUMA -&gt; {<br>print ("friend")<br>}<br>CORTES -&gt; {<br>print ("foe")<br>}<br>}</pre><a href="https://github.com/wordpress-mobile/WordPress-Aztec-Android">Link</a><br><span></span><div class="first"><div class="second"><div class="third">Div<br><span><b>Span</b></span><br>Hidden</div><div class="fourth"></div><div class="fifth"></div></div><span class="second last"></span></div><br><!--Comment--><!--more--><br><!--nextpage--><br><code>if (value == 5) printf(value)</code><br><iframe class="classic">Menu</iframe><br>👍测试一个<br><br>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. [video src="https://examplebloge.files.wordpress.com/2017/06/d7d88643-88e6-d9b5-11e6-92e03def4804.mp4"][wpvideo OcobLTqC][wpvideo OcobLTqC w=640 h=400 autoplay=true html5only=true3][audio src="https://upload.wikimedia.org/wikipedia/commons/9/94/H-Moll.ogg"]<!-- wp:core/image {"id":316} --> <figure class="wp-block-image"><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/9/98/WordPress_blue_logo.svg/1200px-WordPress_blue_logo.svg.png" alt="" /> <figcaption>The WordPress logo! </figcaption></figure><!-- /wp:core/image --><blockquote>לְצַטֵט<br>same quote but LTR</blockquote>
2019-03-26 15:18:59.288 25339-25339/org.wordpress.aztec D/WordPress-EDITOR: Below are the details of the content in the editor:
2019-03-26 15:18:59.323 25339-25339/org.wordpress.aztec D/WordPress-EDITOR: vjffjff Fufjf ffufu f¶¶Caption¶Heading 1¶Heading 2¶Heading 3¶Heading 4¶Heading 5¶Heading 6¶Bold¶Italic¶Underline¶Strikethrough¶Ordered¶should have color¶¶Unordered¶Should not have color¶Quote¶when (person) {¶MOCTEZUMA -> {¶print ("friend")¶}¶CORTES -> {¶print ("foe")¶}¶}¶Link¶¶Div¶Span¶Hidden¶¶¶¶¶Comment¶¶¶¶¶if (value == 5) printf(value)¶¶👍测试一个¶¶Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. [video src="https://examplebloge.files.wordpress.com/2017/06/d7d88643-88e6-d9b5-11e6-92e03def4804.mp4"][wpvideo OcobLTqC][wpvideo OcobLTqC w=640 h=400 autoplay=true html5only=true3][audio src="https://upload.wikimedia.org/wikipedia/commons/9/94/H-Moll.ogg"]¶ ¶¶ ¶The WordPress logo! ¶לְצַטֵט¶same quote but LTR  length = 791
    >----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------<       000 -> 791 : ChangeWatcher
    >----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------<       000 -> 791 : ChangeWatcher
                          >--------->                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              022 -> 032 : CaptionShortcodeSpan
                          <>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
2019-03-26 15:18:59.326 1110-2516/? W/ActivityManager:   Force finishing activity org.wordpress.aztec/.demo.MainActivity

Reproduced

  1. Open the Aztec demo app
  2. tap right at the beginning of content (before the image), and type some words
  3. select the last word right before the image
  4. press the backspace key
  5. observe crash

Tested

[Google Pixel 2] on [Android 8.1] with [latest]

@mzorz
Copy link
Contributor Author

mzorz commented Mar 26, 2019

@mzorz
Copy link
Contributor Author

mzorz commented Mar 26, 2019

Considering whether this is a possible duplicate of #729. One thing I've seen here is that trying to select the last word before the image in the newly entered text, by double tapping on it, actually selects both the last word and the image block completely. So there must be something in there about boundaries that is not being handled correctly.

If you delete a character within the last word, and then double tap on the last word, it gets correctly fully selected (without selecting the image). Then, tapping backspace sometimes just deletes the text, and typing any new character makes the app crash (situation described in #729).

@mzorz
Copy link
Contributor Author

mzorz commented Mar 26, 2019

Closing - definitely a duplicate of #729 and further info described in wordpress-mobile/WordPress-Android#8828, wordpress-mobile/WordPress-Android#9470

@mzorz mzorz closed this as completed Mar 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant