From 6296e6a8bd1a08bcce5e40ff16cf2badcb76d9c4 Mon Sep 17 00:00:00 2001 From: Nova Date: Thu, 27 Nov 2025 12:05:04 +0330 Subject: [PATCH] Add panic recovery to catch the panic message --- core/server/main.go | 7 +++++++ src/ui/mainwindow.cpp | 1 - 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/core/server/main.go b/core/server/main.go index a8136c5..19644a0 100644 --- a/core/server/main.go +++ b/core/server/main.go @@ -64,6 +64,13 @@ func RunCore() { } func main() { + defer func() { + if err := recover(); err != nil { + fmt.Println("Core panicked:") + fmt.Println(err) + os.Exit(0) + } + }() fmt.Println("sing-box:", C.Version) fmt.Println() runtimeDebug.SetMemoryLimit(2 * 1024 * 1024 * 1024) // 2GB diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp index a0b32d9..b863479 100644 --- a/src/ui/mainwindow.cpp +++ b/src/ui/mainwindow.cpp @@ -970,7 +970,6 @@ void MainWindow::prepare_exit() return; } hide(); - // tray->hide(); Configs::dataStore->prepare_exit = true; // RegisterHiddenMenuShortcuts(true);