Crash in -[DTCoreTextLayoutFrame _enumerateTextBlocksAtLevel:inRange:usingBlock:] #669

Closed
iOkay opened this Issue Nov 7, 2013 · 9 comments

Comments

Projects
None yet
2 participants

iOkay commented Nov 7, 2013

Hi, I am using the develop. It is crash, when I scroll the text view. Like the picture show:
screen shot 2013-11-07 at 2 36 18

How to fix it?

Collaborator

odrobnik commented Nov 7, 2013

Exact steps to reproduce please.

Von meinem iPhone gesendet

Am 07.11.2013 um 07:43 schrieb Hub_Okay notifications@github.com:

Hi, I am using the develop. It is crash, when I scroll the text view. Like the picture show:

How to fix it?


Reply to this email directly or view it on GitHub.

iOkay commented Nov 7, 2013

I am using ipad 3, ios 6.1.
Select the "war & Peace". When the text view show, slide it very quickly, and then it crashed.

iOkay commented Nov 8, 2013

I think it is a problem about multithreading. When I make "[self.layoutFrame drawInContext:ctx options:options];" (in DTAttributedTextContentView.m Line 463) run in main thread, like this :
"DTBlockPerformSyncOnMainThread(^{
[self.layoutFrame drawInContext:ctx options:options];
});"
It will be okay, but some new issue appear. It will be unsmooth and delayed when I scroll up the view with a big image.

iOkay commented Nov 8, 2013

@Cocoanetics ,I am sorry to say that the Issue #606 is not fixed completely. It is appear again in the develop version.
screen shot 2013-11-08 at 6 14 00

I run the dome with ipad3 ios 6.1 . Use the text view to show a big file, like "war & peace". Just scroll the view quickly. After serval times It crashed.

Collaborator

odrobnik commented Nov 14, 2013

@hubokay Are you able to reproduce it in Simulator or only on Device?

Collaborator

odrobnik commented Nov 14, 2013

It appears to be a bug in Core Text that comes from trying to enumerate attributes from a background thread. The only other workaround - besides synchronizing onto the main thread - would be to determine the block ranges once for the entire layout frame and then use that for the enumeration.

The War & Peace is an extreme example meant to be used for performance testing. Are you able to reproduce this on other real life documents as well?

odrobnik added a commit that referenced this issue Nov 14, 2013

Collaborator

odrobnik commented Nov 14, 2013

@hubokay I changed to a different method for enumeration that is able to recognize longer blocks as being contiguous. This seems to greatly improve scrolling performance. Please inspect this and give your verdict.

iOkay commented Nov 15, 2013

@Cocoanetics Thanks a lot for your support. The bug could be reproduce but not regularly. The War & Peace is an extreme example but it is the easiest way to reproduce it. I found this while I am work on a EPUB reader with the DTCoreText.

iOkay commented Nov 15, 2013

@Cocoanetics Thanks again. It works very well. After many tests with different files, it works well. I think it be fixed.

@iOkay iOkay closed this Nov 15, 2013

odrobnik added a commit that referenced this issue Nov 15, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment