ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
2

Subscriber::shutdown() required to be called manually on destruction?

asked 2013-01-12 10:55:39 -0500

updated 2014-01-28 17:14:49 -0500

ngrennan gravatar image

TL;DR

Is calling Subscriber::shutdown() explicitly required to prevent callbacks from being called after object destruction?


TS;DU (too short, didn't understand)

I've recently been doing some work were objects containing subscribers are created and destroyed while the node is still running. At the same time I've been getting crashes in my code that imply that the callbacks connected to said subscribers are being called seemingly after the subscriber has been destroyed, and thus causing segfaults and memory corruptions when that callback accesses member data.

Upon noticing this I started explicitly calling Subscriber::shutdown() in my destructors and the problem crashes stopped. Previously I had assumed Subscriber::~Subscriber() would have taken care of this. I looked at the code and Subscriber::shutdown() is not explicitly called.

So is this the expected behavior? Is this a bug?

edit retag flag offensive close merge delete

Comments

If I'm able to, will do.

Asomerville gravatar image Asomerville  ( 2013-01-13 10:02:17 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2013-01-13 09:54:27 -0500

Eric Perko gravatar image

updated 2013-01-13 09:55:35 -0500

This sounds like a bug. I suggest you file a ticket with a minimal code snippet that reproduces the issue, if possible, and post the link to the ticket as an answer to this question.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2013-01-12 10:55:39 -0500

Seen: 1,005 times

Last updated: Jan 13 '13