From 9fb02e4bff199fd20f106d5c71a646b43dc97cbf Mon Sep 17 00:00:00 2001 From: Alan Griffiths Date: Wed, 25 Sep 2024 11:36:55 +0100 Subject: [PATCH] Do not extend the `InputDeviceHub` lifetime beyond teardown --- src/miral/input_configuration.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/miral/input_configuration.cpp b/src/miral/input_configuration.cpp index 3afa5016542..69a7f1176d7 100644 --- a/src/miral/input_configuration.cpp +++ b/src/miral/input_configuration.cpp @@ -38,7 +38,7 @@ class miral::InputConfiguration::Touchpad::Self : public TouchpadInputConfigurat class miral::InputConfiguration::Self { public: - std::shared_ptr input_device_hub{}; + std::weak_ptr input_device_hub{}; std::shared_ptr input_device_config; auto mouse() -> Mouse; @@ -48,9 +48,9 @@ class miral::InputConfiguration::Self void apply(Mouse const& m) { - if (input_device_hub) + if (auto const idh = input_device_hub.lock()) { - input_device_hub->for_each_mutable_input_device([&m](auto& input_device) + idh->for_each_mutable_input_device([&m](auto& input_device) { m.self->apply_to(input_device); }); @@ -61,9 +61,9 @@ class miral::InputConfiguration::Self void apply(Touchpad const& t) { - if (input_device_hub) + if (auto const idh = input_device_hub.lock()) { - input_device_hub->for_each_mutable_input_device([&t](auto& input_device) + idh->for_each_mutable_input_device([&t](auto& input_device) { t.self->apply_to(input_device); });