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

widget.NewEntry selectall\copy is crash on androild 7.1 on go 1.15,fyne 1.4.0 #1511

Closed
ddkwork opened this issue Nov 6, 2020 · 13 comments
Closed
Labels
bug Something isn't working

Comments

@ddkwork
Copy link

ddkwork commented Nov 6, 2020

widget.NewEntry selectall\copy is crash on androild 7.1 on go 1.15,fyne 1.4.0

@andydotxyz
Copy link
Member

Can you provide the crash log from adb please? It would be very helpful.

@andydotxyz andydotxyz added blocker Items that would block a forthcoming release bug Something isn't working labels Nov 6, 2020
@ddkwork
Copy link
Author

ddkwork commented Nov 6, 2020

log.txt

thank you very mush.

@andydotxyz
Copy link
Member

Can you please provide more information about the device you are using? I have not been able to replicate the crash, or find a likely cause from the log.

@andydotxyz andydotxyz removed the blocker Items that would block a forthcoming release label Nov 6, 2020
@ddkwork
Copy link
Author

ddkwork commented Nov 6, 2020

您能否提供有关所使用设备的更多信息?我无法复制崩溃,也无法从日志中找到可能的原因。


Build fingerprint: 'Xiaomi/hydrogen/hydrogen:7.0/NRD90M/V8.5.1.0.NBCMIED:user/release-keys'
Revision: '0'
ABI: 'arm64'
pid: 31354, tid: 31478, name: Thread-15 >>> com.example.myapp <<<
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
Abort message: 'art/runtime/java_vm_ext.cc:470] JNI DETECTED ERROR IN APPLICATION: JNI GetObjectClass called with pending exception java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()'
x0 0000000000000000 x1 0000000000007af6 x2 0000000000000006 x3 0000000000000008
x4 000000000000001a x5 0000007f927b5880 x6 44577b927f000000 x7 0000007f927b5744
x8 0000000000000083 x9 ffffffffffffffdf x10 0000000000000000 x11 0000000000000001
x12 ffffffffffffffff x13 0000000000000001 x14 000000000001ae40 x15 0000000000001fe3
x16 0000007f927f3ed8 x17 0000007f927a14d0 x18 0000000000000000 x19 0000007f4bcfd4f8
x20 0000000000000006 x21 0000007f4bcfd450 x22 0000000000000000 x23 0000000000000c68
x24 ffffffffffffffff x25 0000007f911fc730 x26 0000007f911870f0 x27 0000007f4bcfcc61
x28 0000007f9114d2fb x29 0000007f4bcfcb90 x30 0000007f9279e960
sp 0000007f4bcfcb70 pc 0000007f927a14d8 pstate 0000000060000000

backtrace:
#00 pc 000000000006b4d8 /system/lib64/libc.so (tgkill+8)
#1 pc 000000000006895c /system/lib64/libc.so (pthread_kill+64)
#2 pc 0000000000023ea8 /system/lib64/libc.so (raise+24)
#3 pc 000000000001c92c /system/lib64/libc.so (abort+52)
#4 pc 000000000042cb9c /system/lib64/libart.so (_ZN3art7Runtime5AbortEv+352)
#5 pc 00000000000e4b24 /system/lib64/libart.so (_ZN3art10LogMessageD2Ev+1204)
#6 pc 00000000002ec654 /system/lib64/libart.so (ZN3art9JavaVMExt8JniAbortEPKcS2+2172)
#7 pc 00000000002ec928 /system/lib64/libart.so (_ZN3art9JavaVMExt9JniAbortVEPKcS2_St9__va_list+120)
#8 pc 0000000000101780 /system/lib64/libart.so (_ZN3art11ScopedCheck6AbortFEPKcz+156)
#9 pc 0000000000101190 /system/lib64/libart.so (_ZN3art11ScopedCheck11CheckThreadEP7_JNIEnv+544)
#10 pc 00000000000fecc8 /system/lib64/libart.so (_ZN3art11ScopedCheck5CheckERNS_18ScopedObjectAccessEbPKcPNS_12JniValueTypeE+1120)
#11 pc 00000000000f51cc /system/lib64/libart.so (_ZN3art8CheckJNI14GetObjectClassEP7_JNIEnvP8_jobject+620)
#12 pc 000000000090223c /data/app/com.example.myapp-2/lib/arm64/libfyneTest.so (setClipboardContent+220)

@jiqi136
Copy link

jiqi136 commented Nov 7, 2020

The reason for the crash is because of copying characters or using the paste function

var clipboard=Window.Clipboard()

string=clipboard.Content()

clipboard.SetContent("str")

================
2B's solution is
Enter a few characters at will, then double-click on the characters, the cursor of the Xiaomi system appears, and you can use the copy and paste functions.
---From Redmi 2 来自 红米2

@ddkwork
Copy link
Author

ddkwork commented Nov 7, 2020

@jiqi136
sorry,i can not pass this test,windows is ok, android is crash so.

package main

import (
"fyne.io/fyne/app"
"fyne.io/fyne/widget"
)

//var clipboard fyne.Clipboard

func main() {
myApp := app.New()
myWindow := myApp.NewWindow("Entry Widget")

input := widget.NewEntry()
input.SetPlaceHolder("Enter text...")

//clipboard = myWindow.Clipboard()
//str := clipboard.Content()
//clipboard.SetContent(str)

content := widget.NewVBox(input, widget.NewButton("Save", func() {
	println("Content was:", input.Text)
}))

myWindow.SetContent(content)
myWindow.ShowAndRun()

}

@jiqi136
Copy link

jiqi136 commented Nov 7, 2020

When I replied, I might not be able to open the link in a few days, and I was a little dizzy.

To use the copy and paste function without crashing, three conditions are required.

Condition 1: Multi-line input box

var widgetinput = widget.NewMultiLineEntry()

Condition 2: Use border layout, multi-line input box exclusive middle position

var interface border layout =fyne.NewContainerWithLayout(layout.NewBorderLayout(NewVBox, nil, nil, nil), NewVBox, widgetinput)

Condition 3: Operation method

Enter a few characters at will, then double-click on the characters,
the cursor of the Xiaomi system appears, and you can use the copy and paste functions.

@ddkwork
Copy link
Author

ddkwork commented Nov 7, 2020

@jiqi136
package main

import (
"fyne.io/fyne"
"fyne.io/fyne/app"
"fyne.io/fyne/layout"
"fyne.io/fyne/theme"
"fyne.io/fyne/widget"
)

func main() {
myApp := app.New()
myWindow := myApp.NewWindow("Entry Widget")

myApp.Settings().SetTheme(theme.LightTheme())

//input := widget.NewEntry()
//input.SetPlaceHolder("Enter text...")
//
//content := widget.NewVBox(input,
//	widget.NewCard("cpuid", "", widget.NewVBox(
//		widget.NewEntry(),
//		widget.NewEntry(),
//		widget.NewButton("", nil),
//	)),
//	widget.NewButton("Save", func() {
//		println("Content was:", input.Text)
//	}))

//myWindow.SetContent(content)
myWindow.SetContent(NEW())
myWindow.ShowAndRun()

}

func NEW() *fyne.Container {
NewVBox := widget.NewVBox(
widget.NewEntry(),
widget.NewEntry(),
widget.NewButton("", nil),
)
widgetinput := widget.NewMultiLineEntry()
borderlayout := fyne.NewContainerWithLayout(layout.NewBorderLayout(NewVBox, nil, nil, nil), NewVBox, widgetinput)
return borderlayout
}

//click selectall and then click copy was crashed so.

@jiqi136
Copy link

jiqi136 commented Nov 7, 2020

@DiskGetor

There are official examples, local directories
src\github.com\fyne-io\examples\cmd\textedit
https://github.com/fyne-io/examples/tree/develop/textedit
After the Android apk is generated,

Condition 3: Operation method
Enter a few characters at will, then double-click on the characters,
the cursor of the Xiaomi system appears, and you can use the copy and paste functions.

(This method is not very useful, because the operation is too complicated for the user, and we still wait for the official solution)

@ddkwork
Copy link
Author

ddkwork commented Nov 7, 2020

@DiskGetor

有官方示例,本地目录
src \ github.com \ fyne-io \ examples \ cmd \ textedit
https://github.com/fyne-io/examples/tree/develop/textedit
生成Android APK后,

条件3:操作方法 随意
输入几个字符,然后双击这些字符,
出现小米系统的光标,即可使用复制和粘贴功能。

oh my gad, it work,thank you, i will read the codes.

@ddkwork
Copy link
Author

ddkwork commented Nov 7, 2020

@jiqi136
func main() {
myApp := app.New()
//Show(myApp)
//myApp.Run()
myWindow := myApp.NewWindow("Entry Widget")
myApp.Settings().SetTheme(theme.LightTheme())
NewEntry := widget.NewEntry()
NewEntry.OnChanged = func(s string) {
switch "popUp name"{//how to export Entry's popUp name ? i was read editor codes,but i do not konwn how to fix this crash.
case "Cut":
NewEntry.TypedShortcut(&fyne.ShortcutCut{Clipboard: myWindow.Clipboard()})
case "Copy":
NewEntry.TypedShortcut(&fyne.ShortcutCopy{Clipboard: myWindow.Clipboard()})
case "Paste":
NewEntry.TypedShortcut(&fyne.ShortcutPaste{Clipboard: myWindow.Clipboard()})
case "Select all":
//NewEntry.TypedShortcut(&fyne.ShortcutSelectAll{Clipboard: myWindow.Clipboard()})
}
}
myWindow.SetContent(container.NewVBox(NewEntry, widget.NewButton("", nil)))
myWindow.ShowAndRun()
}

@andydotxyz
Copy link
Member

I have finally managed to replicate on an old HTC device.
Seems to be failing to make changes to the clipboard:

I/DEBUG ( 129): backtrace:
I/DEBUG ( 129): #00 pc 0004ad0e /system/lib/libdvm.so (dvmAbort+121)
I/DEBUG ( 129): #1 pc 0004f4a1 /system/lib/libdvm.so (dvmDecodeIndirectRef(Thread*, _jobject*)+320)
I/DEBUG ( 129): #2 pc 0005212b /system/lib/libdvm.so
I/DEBUG ( 129): #3 pc 00460c1c /data/data/io.fyne.demo/lib/libfyne_demo.so (setClipboardContent+220)

andydotxyz added a commit that referenced this issue Nov 9, 2020
@andydotxyz
Copy link
Member

This no longer crashes on release/v1.4.x branch, will release in v1.4.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants