diff --git a/rclcpp/include/rclcpp/client.hpp b/rclcpp/include/rclcpp/client.hpp index 1a70723..6b957d4 100644 --- a/rclcpp/include/rclcpp/client.hpp +++ b/rclcpp/include/rclcpp/client.hpp @@ -54,7 +54,7 @@ public: : node_handle_(node_handle), client_handle_(client_handle), service_name_(service_name) {} - ~ClientBase() + virtual ~ClientBase() { if (client_handle_) { if (rmw_destroy_client(client_handle_) != RMW_RET_OK) { diff --git a/rclcpp/include/rclcpp/executors/multi_threaded_executor.hpp b/rclcpp/include/rclcpp/executors/multi_threaded_executor.hpp index d16135c..5eb2bc3 100644 --- a/rclcpp/include/rclcpp/executors/multi_threaded_executor.hpp +++ b/rclcpp/include/rclcpp/executors/multi_threaded_executor.hpp @@ -48,7 +48,7 @@ public: } } - ~MultiThreadedExecutor() {} + virtual ~MultiThreadedExecutor() {} void spin() diff --git a/rclcpp/include/rclcpp/executors/single_threaded_executor.hpp b/rclcpp/include/rclcpp/executors/single_threaded_executor.hpp index ebcd51d..b54b445 100644 --- a/rclcpp/include/rclcpp/executors/single_threaded_executor.hpp +++ b/rclcpp/include/rclcpp/executors/single_threaded_executor.hpp @@ -42,7 +42,7 @@ public: SingleThreadedExecutor() {} - ~SingleThreadedExecutor() {} + virtual ~SingleThreadedExecutor() {} void spin() { diff --git a/rclcpp/include/rclcpp/publisher.hpp b/rclcpp/include/rclcpp/publisher.hpp index e481bfd..f7810bd 100644 --- a/rclcpp/include/rclcpp/publisher.hpp +++ b/rclcpp/include/rclcpp/publisher.hpp @@ -45,7 +45,7 @@ public: : node_handle_(node_handle), publisher_handle_(publisher_handle) {} - ~Publisher() + virtual ~Publisher() { if (publisher_handle_) { if (rmw_destroy_publisher(node_handle_.get(), publisher_handle_) != RMW_RET_OK) { diff --git a/rclcpp/include/rclcpp/service.hpp b/rclcpp/include/rclcpp/service.hpp index c05282e..3c9d7c3 100644 --- a/rclcpp/include/rclcpp/service.hpp +++ b/rclcpp/include/rclcpp/service.hpp @@ -53,7 +53,7 @@ public: : node_handle_(node_handle), service_handle_(service_handle), service_name_(service_name) {} - ~ServiceBase() + virtual ~ServiceBase() { if (service_handle_) { if (rmw_destroy_service(service_handle_) != RMW_RET_OK) { diff --git a/rclcpp/include/rclcpp/subscription.hpp b/rclcpp/include/rclcpp/subscription.hpp index b327ba0..5aa0878 100644 --- a/rclcpp/include/rclcpp/subscription.hpp +++ b/rclcpp/include/rclcpp/subscription.hpp @@ -59,7 +59,7 @@ public: (void)ignore_local_publications_; } - ~SubscriptionBase() + virtual ~SubscriptionBase() { if (subscription_handle_) { if (rmw_destroy_subscription(node_handle_.get(), subscription_handle_) != RMW_RET_OK) { diff --git a/rclcpp/include/rclcpp/timer.hpp b/rclcpp/include/rclcpp/timer.hpp index 3e464f5..6b7c969 100644 --- a/rclcpp/include/rclcpp/timer.hpp +++ b/rclcpp/include/rclcpp/timer.hpp @@ -64,7 +64,7 @@ public: } } - ~TimerBase() + virtual ~TimerBase() { if (guard_condition_) { if (rmw_destroy_guard_condition(guard_condition_) != RMW_RET_OK) { @@ -107,7 +107,7 @@ public: thread_ = std::thread(&GenericTimer::run, this); } - ~GenericTimer() + virtual ~GenericTimer() { cancel(); thread_.join();