[BUG] 有时候启动时卡死在w,show(true) 里面,程序就不动了。
happychui opened this issue · comments
Fusion commented
Bug 描述
对错误是什么的清晰描述。
预期行为
清晰的描述您期望发生的事情。
截图
如果可以,请添加屏幕截图以帮助解释您的问题。
系统:
系统和版本。
其他
其他想说的。
twgh commented
init之后到run之前不要进行很耗时的操作, 可以把下面的代码加到run上面
time.AfterFunc(time.Millisecond*10, func() {
go func() {
//一些耗时的操作, 比如从网络获取数据
}()
})
twgh commented
另外注意如果你要在协程里操作ui的话, 使用xc.CallUT(), 在回调里操作ui, 这指的是对ui的一些写的操作和redraw等
Fusion commented
什么都没做,只添加了几个2个控件
「twgh ***@***.***>」在 2024年4月16日 週二,下午6:36 寫道:
… init之后到run之前不要进行很耗时的操作, 可以把下面的代码加到run上面
time.AfterFunc(time.Millisecond*10, func() {
go func() {
//一些耗时的操作, 比如从网络获取数据
}()
})
—
Reply to this email directly, view it on GitHub
<#28 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAU3BRMUTEWYV2TLAQVZEBTY5T5MDAVCNFSM6AAAAABGJB2G42VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJYG43TGNZSGM>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
Fusion commented
程序里面只有两个控件显示
「twgh ***@***.***>」在 2024年4月16日 週二,下午6:40 寫道:
… 另外注意如果你要在协程里操作ui的话, 使用xc.CallUT(), 在回调里操作ui, 这指的是对ui的一些写的操作和redraw等
—
Reply to this email directly, view it on GitHub
<#28 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAU3BRJETZQXL5GOSLKSZLTY5T5ZZAVCNFSM6AAAAABGJB2G42VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJYG43TSNJWGI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
Fusion commented
多运行几次就有机会卡了
「Roy Chui ***@***.***>」在 2024年4月16日 週二,下午6:41 寫道:
… 程序里面只有两个控件显示
「twgh ***@***.***>」在 2024年4月16日 週二,下午6:40 寫道:
> 另外注意如果你要在协程里操作ui的话, 使用xc.CallUT(), 在回调里操作ui, 这指的是对ui的一些写的操作和redraw等
>
> —
> Reply to this email directly, view it on GitHub
> <#28 (comment)>, or
> unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAU3BRJETZQXL5GOSLKSZLTY5T5ZZAVCNFSM6AAAAABGJB2G42VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJYG43TSNJWGI>
> .
> You are receiving this because you authored the thread.Message ID:
> ***@***.***>
>
Fusion commented
init之后到run之前不要进行很耗时的操作, 可以把下面的代码加到run上面
time.AfterFunc(time.Millisecond*10, func() { go func() { //一些耗时的操作, 比如从网络获取数据 }() })
还没到run, show已经过不去了
Fusion commented
把这个放到ui初始化前
runtime.LockOSThread()
defer runtime.UnlockOSThread()
这个有效,谢谢