Skip to content

std::move and std::static_pointer_cast of mock objects cause segmentation faults #46

Open

Description

@mstaz

What's the idea behind using get() instead of release() in std::move and static_pointer_cast functions?
It seems like the unique and shared pointers are doubled with that. Both destructors try to free the memory what leads to segmentation faults in some cases. A manual release() on one of the pointers helps here.

Of course it would be helpful to have the mock object still available even after move. Maybe it'd make sense to provide an empty Deleter to the new pointers to let the mock object free the memory.

Activity

  1. mstaz commented on Nov 24, 2020

    @mstaz
    ContributorAuthor

    It seems that the important thing is that the mock object stays alive as long as all moved pointers. And it even seems that it can be accessed after the pointers are destroyed. But I don't know why this is the case 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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