2.2.0 pre4 (#84)

* Fix crash

* Update: Flutter 1223

* fix: networktestdialog crash

* Update Flutter 1223

* bump profile version to 02.02.42.02

* bump min_firm_ver to 1.0.0
This commit is contained in:
xiaoyeliu
2025-12-23 15:52:08 +08:00
committed by GitHub
parent 792f1e12f3
commit 4423dce212
20 changed files with 74934 additions and 75209 deletions

View File

@@ -516,8 +516,28 @@ void SSWCP_Instance::sw_OpenNetworkDialog() {
finish_job();
wxGetApp().CallAfter([]() {
NetworkTestDialog dlg(wxGetApp().mainframe);
dlg.ShowModal();
// Use shared_ptr to manage dialog lifetime
auto dlg = std::make_shared<NetworkTestDialog>(wxGetApp().mainframe);
dlg->ShowModal();
// Keep dialog alive for 2 seconds after closing to allow background threads to finish
// Use a timer to delay the destruction
class DelayedReleaseTimer : public wxTimer
{
std::shared_ptr<NetworkTestDialog> m_dialog;
public:
DelayedReleaseTimer(std::shared_ptr<NetworkTestDialog> dlg) : m_dialog(std::move(dlg))
{
StartOnce(5000); // 5 seconds delay
}
void Notify() override
{
m_dialog.reset(); // Release the dialog
delete this; // Delete the timer itself
}
};
new DelayedReleaseTimer(dlg);
});
}
catch (std::exception& e) {