Please sign in to comment.
Correct move construction/assignment implementation (#370)
Secure Session stores a pointer to callback structure, therefore it must be pinned in memory. We cannot simply copy secure_session_user_callbacks_t into a different place in memory. secure_session_t will still keep a reference to the old memory location. We have to store the callback structure on heap as well. This keeps the address constant and we can move the C++ wrapper structure correctly. Other language wrappers use mostly the same approach, keeping both secure_session_t and secure_session_user_callbacks_t allocated on heap. Note that we have to accurately manage the objects stored in fields. We use new/delete instead of smart pointers in order to be compatible with C++03 (std::auto_ptr is broken and deprecated).
- Loading branch information...
Showing with 24 additions and 10 deletions.