use native win32 messagebox to prevent wails dialog crash
All checks were successful
Deploy on Master Change / deploy (push) Successful in 37s

This commit is contained in:
2026-07-01 08:54:01 +07:00
parent 745e93d28d
commit 7a8c397538
3 changed files with 38 additions and 15 deletions

View File

@@ -222,21 +222,10 @@ func (a *App) startup(ctx context.Context) {
lastKillDialogTime = time.Now()
killDialogMu.Unlock()
go func() {
defer func() {
if r := recover(); r != nil {
log.Printf("[APP] Recovered from MessageDialog panic: %v", r)
}
}()
if a.ctx == nil {
return
}
_, _ = runtime.MessageDialog(a.ctx, runtime.MessageDialogOptions{
Type: runtime.WarningDialog,
Title: "Ứng dụng bị đóng",
Message: fmt.Sprintf("Hệ thống đã tự động đóng ứng dụng '%s' (%s) do không nằm trong danh sách các ứng dụng được phép sử dụng trong giờ học.", procName, title),
})
}()
winapi.ShowWarningMessageBox(
"Ứng dụng bị đóng",
fmt.Sprintf("Hệ thống đã tự động đóng ứng dụng '%s' (%s) do không nằm trong danh sách các ứng dụng được phép sử dụng trong giờ học.", procName, title),
)
}
// Giám sát môi trường Windows: đa màn hình, desktop ảo, đổi user