You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Suppose a multiline entry has a long text in it, with some part selected. If SetText() is called on the entry with a new text shorter than the original text, the selected region may be out of bounds of the new text. I don't know what the proper behavior should be, but as of now this results in a nil pointer dereference originating from the function entryContentRendered.buildSelection in widget/entry.go. An examination in debugger shows that in that function the object r.content.entry has:
Updated (short) text.
Updated cursor position (at the very end of the new text since previous cursor position was even further).
Old values of selectRow and selectColumn (i.e., specifying a position that does not exist in the new text).
This leads to a wrong computation of rowCount, and eventually lineSizeToColumn is called with an out of bounds arguments.
Notes:
At some moment before the segmentation fault the cursor position was modified to be consistent with the new text, but the selected position was not. Maybe this happens in entryRenderer.Refresh(), but I'm not sure.
I've originally discovered this when .SetText() was called while I, as a user, was in the process of changing the selection state by dragging the mouse. Probably any fix would cover this situation as well.
This happens regardless of whether the multiline entry has wrapping enabled.
To Reproduce:
Steps to reproduce the behaviour:
Compile the example code below and run it.
Scroll down a bit and select some text.
Wait 5 seconds until the timer calls entry.SetText().
Describe the bug:
Suppose a multiline entry has a long text in it, with some part selected. If
SetText()
is called on the entry with a new text shorter than the original text, the selected region may be out of bounds of the new text. I don't know what the proper behavior should be, but as of now this results in a nil pointer dereference originating from the functionentryContentRendered.buildSelection
in widget/entry.go. An examination in debugger shows that in that function the objectr.content.entry
has:This leads to a wrong computation of
rowCount
, and eventuallylineSizeToColumn
is called with an out of bounds arguments.Notes:
entryRenderer.Refresh()
, but I'm not sure..SetText()
was called while I, as a user, was in the process of changing the selection state by dragging the mouse. Probably any fix would cover this situation as well.To Reproduce:
Steps to reproduce the behaviour:
entry.SetText()
.Example code:
Device (please complete the following information):
The text was updated successfully, but these errors were encountered: