ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

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


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


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

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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


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

Seen: 951 times

Last updated: Jan 13 '13