FIX: destory timers & check webview consist

Change-Id: If95a973e1b3c6bf0da3611c30e0e44e191c9b06a
This commit is contained in:
chunmao.guo 2022-08-09 09:20:33 +08:00 committed by Lane.Wei
parent cd3a721f86
commit 7be639019e
8 changed files with 19 additions and 10 deletions

View File

@ -83,6 +83,8 @@ MarkdownTip::MarkdownTip()
_timer->Bind(wxEVT_TIMER, &MarkdownTip::OnTimer, this); _timer->Bind(wxEVT_TIMER, &MarkdownTip::OnTimer, this);
} }
MarkdownTip::~MarkdownTip() { delete _timer; }
void MarkdownTip::LoadStyle() void MarkdownTip::LoadStyle()
{ {
_language = GUI::into_u8(GUI::wxGetApp().current_language_code()); _language = GUI::into_u8(GUI::wxGetApp().current_language_code());

View File

@ -28,6 +28,8 @@ private:
MarkdownTip(); MarkdownTip();
~MarkdownTip();
void LoadStyle(); void LoadStyle();
bool ShowTip(wxPoint pos, std::string const &tip, std::string const & tooltip); bool ShowTip(wxPoint pos, std::string const &tip, std::string const & tooltip);
@ -48,13 +50,13 @@ private:
void OnTimer(wxTimerEvent& event); void OnTimer(wxTimerEvent& event);
private: private:
wxWebView* _tipView = NULL; wxWebView * _tipView = nullptr;
std::string _lastTip; std::string _lastTip;
std::string _pendingScript = " "; std::string _pendingScript = " ";
std::string _language; std::string _language;
wxPoint _requestPos; wxPoint _requestPos;
double _lastHeight = 0; double _lastHeight = 0;
wxTimer* _timer; wxTimer* _timer = nullptr;
bool _hide = false; bool _hide = false;
bool _data_dir = false; bool _data_dir = false;
}; };

View File

@ -129,7 +129,7 @@ MonitorPanel::~MonitorPanel()
if (m_refresh_timer) if (m_refresh_timer)
m_refresh_timer->Stop(); m_refresh_timer->Stop();
delete m_refresh_timer;
} }
void MonitorPanel::init_bitmap() void MonitorPanel::init_bitmap()

View File

@ -105,7 +105,7 @@ private:
wxBitmap m_arrow_img; wxBitmap m_arrow_img;
int last_wifi_signal = -1; int last_wifi_signal = -1;
wxTimer* m_refresh_timer; wxTimer* m_refresh_timer = nullptr;
int last_status; int last_status;
bool m_initialized { false }; bool m_initialized { false };

View File

@ -367,6 +367,8 @@ SelectMachinePopup::SelectMachinePopup(wxWindow *parent)
Bind(EVT_DISSMISS_MACHINE_LIST, &SelectMachinePopup::on_dissmiss_win, this); Bind(EVT_DISSMISS_MACHINE_LIST, &SelectMachinePopup::on_dissmiss_win, this);
} }
SelectMachinePopup::~SelectMachinePopup() { delete m_refresh_timer; }
void SelectMachinePopup::Popup(wxWindow *WXUNUSED(focus)) void SelectMachinePopup::Popup(wxWindow *WXUNUSED(focus))
{ {
BOOST_LOG_TRIVIAL(trace) << "get_print_info: start"; BOOST_LOG_TRIVIAL(trace) << "get_print_info: start";
@ -2178,7 +2180,7 @@ bool SelectMachineDialog::Show(bool show)
SelectMachineDialog::~SelectMachineDialog() SelectMachineDialog::~SelectMachineDialog()
{ {
; delete m_refresh_timer;
} }
EditDevNameDialog::EditDevNameDialog(Plater *plater /*= nullptr*/) EditDevNameDialog::EditDevNameDialog(Plater *plater /*= nullptr*/)

View File

@ -181,7 +181,7 @@ class SelectMachinePopup : public wxPopupTransientWindow
{ {
public: public:
SelectMachinePopup(wxWindow *parent); SelectMachinePopup(wxWindow *parent);
~SelectMachinePopup() {} ~SelectMachinePopup();
// wxPopupTransientWindow virtual methods are all overridden to log them // wxPopupTransientWindow virtual methods are all overridden to log them
virtual void Popup(wxWindow *focus = NULL) wxOVERRIDE; virtual void Popup(wxWindow *focus = NULL) wxOVERRIDE;
@ -359,7 +359,7 @@ protected:
void reset_ams_material(); void reset_ams_material();
void update_show_status(); void update_show_status();
wxTimer *m_refresh_timer; wxTimer *m_refresh_timer { nullptr };
std::shared_ptr<PrintJob> m_print_job; std::shared_ptr<PrintJob> m_print_job;

View File

@ -398,8 +398,11 @@ void WebViewPanel::OnClose(wxCloseEvent& evt)
this->Hide(); this->Hide();
} }
void WebViewPanel::OnFreshLoginStatus(wxTimerEvent &event) { void WebViewPanel::OnFreshLoginStatus(wxTimerEvent &event)
Slic3r::GUI::wxGetApp().get_login_info(); {
auto mainframe = Slic3r::GUI::wxGetApp().mainframe;
if (mainframe && mainframe->m_webview == this)
Slic3r::GUI::wxGetApp().get_login_info();
} }
void WebViewPanel::SendRecentList(wxString const &sequence_id) void WebViewPanel::SendRecentList(wxString const &sequence_id)

View File

@ -36,7 +36,7 @@ namespace Slic3r { namespace GUI {
this->Bind(wxEVT_LEFT_UP, &SideTools::on_mouse_left_up, this); this->Bind(wxEVT_LEFT_UP, &SideTools::on_mouse_left_up, this);
} }
SideTools::~SideTools() {} SideTools::~SideTools() { delete m_intetval_timer; }
void SideTools::set_none_printer_mode() void SideTools::set_none_printer_mode()
{ {