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
Once owner pointer releases or transfers its resource, it gets into an "invalid" state.
Deleting such a pointer may lead to immediate memory corruption due to double delete, or to an access violation when the deleted resource is accessed from another owner pointer.
Example 1: Deleting an owner after transferring its value
gsl::owner<State*> validState = nullptr;
gsl::owner<State*> state = ReadState();
validState = state;
if (!IsValid(state))
delete state; // C26404