Copy link to clipboard
Copied
We were finally able to narrow down the source of the elusive errors being thrown in scrollTimerHandler and while handling certain mouse events. The problem seems to stem from some intermittent conditions that cause certain TextLine objects to be invalid at a time that we're not expecting them to be. The condition that causes the exception lies between SelectionManager and TextFlowLine. Details on that below.
We were able to work around this issue in our container controller by overriding the methods that lead to exceptions and wrapping the super call with a try catch. if we catch an error, which was basically due to invalid text lines at unexpected locations, we call on the flow composer to force compose/update of the TextLine's and then re-call the super. This seems to work fairly well, but we're sometimes having to force a lot of composition work at an inopportune time.
Note that we were using build 468 at the time this information was captured and that the information provided may be irrelevant in newer builds.
First of all, here are some notes that one of our developers captured during a debug session when the issue occurred:
The stack that creates the problem is like this, basically starts with user trying to click into the TextFlow, and TLF trying to figure out what anchorPosition was selected
The actual exception is on line 792, where "textLine" is NULL when "globalToLocal" is called.
It is NULL because TextFlowLine:getTextLine returned NULL due to the highlighted condition below at line 634
SelectionManager.as
The code below is prepared to validate if the "validity" state is set to "geometryDamaged",
but, the state is set to "invalid", and it can't deal with that, so it returns NULL, and the code in computeSelectionIndexInContainer blows up.
So, the question is: Why is this textline "invalid", is it supposed to be? Did we find the wrong TextLine?
TextFlowLine.as
Here are some of the variables, leading to the crash. The SelectionManager, TextFlowLine and TextLine are shown
this flashx.textLayout.edit.SelectionManager (@368fd5b1)
textFlow flashx.textLayout.elements.TextFlow (@364aa571)
controller com.xxx.text.container.TexContainerController (@364d60b1)
localX 86 [0x56]
localY 248 [0xf8]
lineIndex 3
firstCharVisible 0
length 19 [0x13]
colRect null
bp "tb"
isTTB false
isDirectionRTL false
perpCoor 248 [0xf8]
distance 32000 [0x7d00]
nearestColIdx 0
prevLineBounds flash.geom.Rectangle (@371ad709)
previousLineIndex 3
lastLineIndexInColumn 3
rtline flashx.textLayout.compose.TextFlowLine (@364eeec1)
rtTextLine flash.text.engine.TextLine (@36687791)
testIndex 2
textLine undefined
localPoint undefined
this flashx.textLayout.compose.TextFlowLine (@364ee6a1)
absoluteStart 18 [0x12]
_absoluteStart 18 [0x12]
ascent 8.3203125
_ascent 8.3203125
columnIndex 0
_columnIndex 0
controller com.xxx.text.container.TextContainerController (@364d60b1)
_controller com.xxx.text.container.TextContainerController (@364d60b1)
descent 2.58984375
_descent 2.58984375
height 14.399999999999999
_height 14.399999999999999
lineOffset 0
_lineOffset 0
location 5
outerTargetWidth 512 [0x200]
_outerTargetWidth 512 [0x200]
_para flashx.textLayout.elements.ParagraphElement (@366da401)
paragraph flashx.textLayout.elements.ParagraphElement (@366da401)
_released false
spaceAfter 0
_spaceAfter 0
spaceBefore 0
_spaceBefore 0
targetWidth 512 [0x200]
_targetWidth 512 [0x200]
textHeight 10.91015625
_textHeight 10.91015625
textLength 1
_textLength 1
_textLineCache flashx.textLayout.external.WeakRef (@368203a1)
textLineExists true
_textWidth 0
unjustifiedTextWidth 0
_unjustifiedTextWidth 0
validity "invalid"
_validity "invalid"
x 50 [0x32]
_x 50 [0x32]
y 238.8
_y 238.8
textLine flash.text.engine.TextLine (@366876a1)
[inherited]
ascent 8.3203125
atomCount 1
contextMenu null
descent 2.58984375
focusRect null
hasGraphicElement false
mirrorRegions null
nextLine null
previousLine null
rawTextLength 1
specifiedWidth 512 [0x200]
tabChildren true
tabEnabled false
tabIndex -1 [0xffffffff]
textBlock flash.text.engine.TextBlock (@3683f581)
textBlockBeginIndex 0
textHeight 10.91015625
textWidth 0
unjustifiedTextWidth 0
userData
flashx.textLayout.compose.TextFlowLine (@364ee6a1)
userData flashx.textLayout.compose.TextFlowLine (@364ee6a1) absoluteStart 18 [0x12] _absoluteStart 18 [0x12] ascent 8.3203125 _ascent 8.3203125 columnIndex 0 _columnIndex 0 controller com.xxx.text.container.TextContainerController (@364d60b1) _controller com.xxx.text.container.TextContainerController (@364d60b1) descent 2.58984375 _descent 2.58984375 height 14.399999999999999 _height 14.399999999999999 lineOffset 0 _lineOffset 0 location 5 outerTargetWidth 512 [0x200] _outerTargetWidth 512 [0x200] _para flashx.textLayout.elements.ParagraphElement (@366da401) paragraph flashx.textLayout.elements.ParagraphElement (@366da401) _released false spaceAfter 0 _spaceAfter 0 spaceBefore 0 _spaceBefore 0 targetWidth 512 [0x200] _targetWidth 512 [0x200] textHeight 10.91015625 _textHeight 10.91015625 textLength 1 _textLength 1 _textLineCache flashx.textLayout.external.WeakRef (@368203a1) textLineExists true _textWidth 0 unjustifiedTextWidth 0 _unjustifiedTextWidth 0 validity "invalid" _validity "invalid" x 50 [0x32] _x 50 [0x32] y 238.8 _y 238.8
validity "invalid"
We later found that we had a few situations where the TextFlow was being damaged directly without the knowledge of the edit manager (which normally ends up calling flowComposer.updateAllControllers() after it modifies the text flow), which resulted in us attempting to reference invalid TextLine's in situations like described above. After handling those cases better, we are rarely hitting the try/catch's in our container controller.
Anyway, since we already had this info captured I thought I'd pass it along in case it helps flush out the actual bug(s) or helps anyone else out there having similar issues.
Thanks,
Brent
Copy link to clipboard
Copied
It's not actually wrong for an INVALID TextLine to be displayed. There's line virtualization code that does that intentionally.
I did fix a variation on this bug. Check out build 500 or greater. Note that our build naming and numbering is changing a bit. The builds will still be posted inside of Gumbo.
Thanks,
Richard
Copy link to clipboard
Copied
Hi Richard,
I am facing the same problem. I my case I drag and drop items.
I am using build 470 dated Fri Jul 17 2009. I downloaded this yesterday. Can you tell from where I can get build 500>.
I am using Flex 3.0.2.
Regards,
Amandeep Singh
Copy link to clipboard
Copied
The release build of Flex 4.0 (14159) contains build 595 of TLF 1.0. You can get it here:
http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+4