mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-25 03:42:05 +00:00
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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user