Skip to content
Snippets Groups Projects

Prevent 'bad weak_ptr exception' when copying return from getRobotNameHelper()

Merged Christoph Pohl requested to merge fix/bad_weak_ptr-RobotStateComponentPlugin into master

The RobotNameHelper uses shared_from_this, which makes copying the class very dangerous. E.g. an 'auto rnh = getRobotNameHelper();' inevitably lead to this error as the the rnh was copied (returned const ref and auto drops const refs --> the type of rnh was RobotNameHelper). To prevent this happening to unknowing users, it now returns a shared_ptr:

Signed-off-by: robdekon_h2t robdekon@kit.edu

Merge request reports

Merged by Christoph PohlChristoph Pohl 2 years ago (Sep 26, 2022 10:00am UTC)

Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
Please register or sign in to reply
Loading