From ae6f58a35cafd52372065c1cc56fac8c3a7bba48 Mon Sep 17 00:00:00 2001 From: Matti Airas Date: Thu, 10 Oct 2024 14:23:20 +0300 Subject: [PATCH] Store Networking obj as shared_ptr in app --- src/sensesp_app.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/sensesp_app.h b/src/sensesp_app.h index d7c4526b6..970a54cb3 100644 --- a/src/sensesp_app.h +++ b/src/sensesp_app.h @@ -46,8 +46,7 @@ class SensESPApp : public SensESPBaseApp { */ SensESPApp(SensESPApp& other) = delete; -~SensESPApp() { - delete networking_; + ~SensESPApp() { delete ota_; delete ws_client_; delete mdns_discovery_; @@ -90,7 +89,7 @@ class SensESPApp : public SensESPBaseApp { SystemStatusController* get_system_status_controller() { return &(this->system_status_controller_); } - Networking* get_networking() { return this->networking_; } + std::shared_ptr& get_networking() { return this->networking_; } SKWSClient* get_ws_client() { return this->ws_client_; } protected: @@ -164,8 +163,9 @@ class SensESPApp : public SensESPBaseApp { ap_ssid_ = SensESPBaseApp::get_hostname(); // create the networking object - networking_ = new Networking("/System/WiFi Settings", ssid_, - wifi_client_password_, ap_ssid_, ap_password_); + networking_ = std::make_shared("/System/WiFi Settings", ssid_, + wifi_client_password_, ap_ssid_, + ap_password_); ConfigItem(networking_); @@ -266,7 +266,7 @@ class SensESPApp : public SensESPBaseApp { int button_gpio_pin_ = SENSESP_BUTTON_PIN; ButtonHandler* button_handler_ = nullptr; - Networking* networking_ = NULL; + std::shared_ptr networking_; OTA* ota_; SKDeltaQueue* sk_delta_queue_;