Skip to content

Typing Chinese characters in widget.Entry and perform undo/redo crashes the app. #5001

Closed
@evanhyd

Description

Checklist

  • I have searched the issue tracker for open issues that relate to the same problem, before opening a new one.
  • This issue only relates to a single bug. I will open new issues for any other problems.

Describe the bug

widget.Entry undo/redo is not compatiable with Chinese characters. Undo/Redo crashes the app when dealing with multiple Chinese characters.

How to reproduce

  1. Create a text entry
  2. Type random Chinese characters (for example, 测试) in the text entry
  3. Call Undo()/Redo() or use the corresponding hotkey
  4. Observe that the text entry transits into error states

//to crash the app

  1. Create a text entry
  2. Type random Chinese characters (for example, 测试) in the text entry
  3. Select all and delete
  4. Perform Undo() twice (ctrl + Z)
  5. Observe that fyne crashes

Screenshots

image
image
image

Example code

Create text entry widget, type in Chinese characters, press ctrl + z, ctrl + y to perform undo and redo.

Fyne version

2.5.0

Go compiler version

1.22

Operating system and version

Windows 10

Additional Information

At: home/Go/dependency/pkg/mod/fyne.io/fyne/[email protected]/internal/driver/glfw/driver_desktop.go:171
panic: runtime error: slice bounds out of range [4:2]

goroutine 11 [running]:
fyne.io/fyne/v2/widget.(*entryModifyAction).sub(...)
home/Go/dependency/pkg/mod/fyne.io/fyne/[email protected]/widget/entry.go:2316
fyne.io/fyne/v2/widget.(*entryModifyAction).Undo(0xc000f55ea0?, {0xc0053aadbe?, 0x7ff6a4a23872?})
home/Go/dependency/pkg/mod/fyne.io/fyne/[email protected]/widget/entry.go:2297 +0x90
fyne.io/fyne/v2/widget.(*entryUndoStack).Undo(0xc000d7fc08?, {0xc0053aadbe?, 0x7f0000c000f55ed8?})
home/Go/dependency/pkg/mod/fyne.io/fyne/[email protected]/widget/entry.go:2378 +0x4c
fyne.io/fyne/v2/widget.(*Entry).Undo(0xc000d7fc08)
home/Go/dependency/pkg/mod/fyne.io/fyne/[email protected]/widget/entry.go:787 +0x49
fyne.io/fyne/v2/widget.(*Entry).registerShortcut.func1({0xc000d7fc58?, 0x7ff6a5349920?})
home/Go/dependency/pkg/mod/fyne.io/fyne/[email protected]/widget/entry.go:1160 +0x17
fyne.io/fyne/v2.(*ShortcutHandler).TypedShortcut(0xc000d7fc58, {0x7ff6a55c8580, 0x7ff6a5b67b80})
home/Go/dependency/pkg/mod/fyne.io/fyne/[email protected]/shortcut.go:21 +0x6e
fyne.io/fyne/v2/widget.(*Entry).TypedShortcut(0xc0002eca20?, {0x7ff6a55c8580?, 0x7ff6a5b67b80?})
home/Go/dependency/pkg/mod/fyne.io/fyne/[email protected]/widget/entry.go:966 +0x25
fyne.io/fyne/v2/internal/driver/glfw.(*window).triggersShortcut.func1()
home/Go/dependency/pkg/mod/fyne.io/fyne/[email protected]/internal/driver/glfw/window.go:912 +0x24
fyne.io/fyne/v2/internal/driver/common.(*Window).RunEventQueue(...)
home/Go/dependency/pkg/mod/fyne.io/fyne/[email protected]/internal/driver/common/window.go:35
created by fyne.io/fyne/v2/internal/driver/glfw.(*gLDriver).createWindow.func1 in goroutine 1
home/Go/dependency/pkg/mod/fyne.io/fyne/[email protected]/internal/driver/glfw/window.go:997 +0x136
2024/07/18 00:06:27 exit status 2
exit status 1

Activity

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

Metadata

Assignees

No one assigned

    Labels

    unverifiedA bug that has been reported but not verified

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions