refactor: convert m_fila_system from raw pointer to shared_ptr

Matches BambuStudio commit c8f70c6ca. DevFilaSystem* m_fila_system
becomes std::shared_ptr<DevFilaSystem>, enabling proper shared ownership
for the AMS drying control feature without no-op deleter hacks.

- DeviceManager.hpp: m_fila_system and GetFilaSystem() use shared_ptr
- DeviceManager.cpp: std::make_shared allocation, remove manual delete,
  add .get() to ParseV1_0 calls
- MoonrakerPrinterAgent.cpp: add .get() to GetFilaSystem() in ParseV1_0
This commit is contained in:
Noisyfox
2026-07-07 17:29:10 +08:00
parent f713c7ae49
commit 922af972c7
3 changed files with 5 additions and 7 deletions

View File

@@ -566,7 +566,7 @@ MachineObject::MachineObject(DeviceManager* manager, NetworkAgent* agent, std::s
m_extder_system = new DevExtderSystem(this);
m_extension_tool = DevExtensionTool::Create(this);
m_nozzle_system = new DevNozzleSystem(this);
m_fila_system = new DevFilaSystem(this);
m_fila_system = std::make_shared<DevFilaSystem>(this);
m_hms_system = new DevHMS(this);
m_config = new DevConfig(this);
@@ -612,8 +612,6 @@ MachineObject::~MachineObject()
delete m_ctrl;
m_ctrl = nullptr;
delete m_fila_system;
m_fila_system = nullptr;
delete m_hms_system;
m_hms_system = nullptr;
@@ -3723,7 +3721,7 @@ int MachineObject::parse_json(std::string tunnel, std::string payload, bool key_
update_printer_preset_name();
update_filament_list();
if (jj.contains("ams")) {
DevFilaSystemParser::ParseV1_0(jj, this, m_fila_system, key_field_only);
DevFilaSystemParser::ParseV1_0(jj, this, m_fila_system.get(), key_field_only);
}
/* vitrual tray*/