Fixed some of detected memory leaks

This commit is contained in:
YuSanka 2025-01-31 23:38:33 +01:00 committed by Lukas Matena
parent ee98a1c31b
commit 254776dd6c
6 changed files with 22 additions and 7 deletions

View File

@ -694,11 +694,11 @@ void Plater::priv::init()
hsizer->Add(sidebar, 0, wxEXPAND | wxLEFT | wxRIGHT, 0);
q->SetSizer(hsizer);
menus.init(q);
// Events:
if (wxGetApp().is_editor()) {
menus.init(q);
// Events:
// Preset change event
this->q->Bind(EVT_OBJ_LIST_OBJECT_SELECT, [this](wxEvent&) { priv::selection_changed(); });
this->q->Bind(EVT_SCHEDULE_BACKGROUND_PROCESS, [this](SimpleEvent&) { this->schedule_background_process(); });

View File

@ -5507,9 +5507,9 @@ void TabSLAMaterial::build_tilt_group(Slic3r::GUI::PageShp page)
// TRN: 'Profile' in this context denotes a group of parameters used to configure
// layer separation procedure for SLA printers.
auto optgroup = page->new_optgroup(L("Profile settings"));
optgroup->on_change = [this, optgroup](const t_config_option_key& key, boost::any value)
optgroup->on_change = [this](const t_config_option_key& key, boost::any value)
{
if (key.find_first_of("use_tilt") == 0)
if (key.find("use_tilt") == 0)
toggle_tilt_options(key == "use_tilt#0");
update_dirty();

View File

@ -106,7 +106,7 @@ void TopBarMenus::UpdateAccountMenu()
void TopBarMenus::RemoveHideLoginItem()
{
if (m_hide_login_item)
account.Remove(m_hide_login_item);
account.Destroy(m_hide_login_item);
}
void TopBarMenus::Popup(TopBarItemsCtrl* popup_ctrl, wxMenu* menu, wxPoint pos)

View File

@ -225,7 +225,13 @@ UserAccountCommunication::UserAccountCommunication(wxEvtHandler* evt_handler, Ap
UserAccountCommunication::~UserAccountCommunication()
{
m_token_timer->Stop();
delete m_token_timer;
m_token_timer = nullptr;
m_polling_timer->Stop();
delete m_polling_timer;
m_polling_timer = nullptr;
if (m_thread.joinable()) {
// Stop the worker thread, if running.
{

View File

@ -117,6 +117,10 @@ wxMenuItem* append_menu_item(wxMenu* menu, int id, const wxString& string, const
entry->SetMenuItem(item);
accelerator_entries_cache().push_back(entry);
}
else {
delete entry;
entry = nullptr;
}
}
#endif

View File

@ -27,6 +27,11 @@ PresetUpdaterWrapper::~PresetUpdaterWrapper()
if (m_ui_status)
m_ui_status->set_canceled(true);
m_worker_thread.join();
if (m_ui_status) {
delete m_ui_status;
m_ui_status = nullptr;
}
}
}