Skip to content

Creating an ImageTransport object inside a ROS node can lead to a circular dependency #311

Open
@KmakD

Description

@KmakD

Creating publishers, subscribers, etc., inside a ROS node implementation is a common practice. I did the same with an ImageTransport object, but this resulted in a circular dependency. When you pass a node (using shared_from_this()) to ImageTransport, it holds a reference to the ROS node, and this node holds a reference to the image transport object, thereby creating a circular dependency.

A common solution to avoid circular dependencies is to use weak pointers. What's your opinion on this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions