You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
std::move and std::static_pointer_cast of mock objects cause segmentation faults #46
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.
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 🤔
Activity
mstaz commentedon Nov 24, 2020
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 🤔