Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix upacking() issues for std::optional, std::shared_ptr, std::set, and std::list #1104

Merged
merged 1 commit into from
Jan 16, 2025

Conversation

linh2931
Copy link
Member

This PR fixes a number of unpacking() issues:

  1. std::optional: the target is not reset if the source does not have a value. This will causes mismatch of source and target if the target already has a value, as that value is kept.
  2. std::shared_ptr: the target is not reset if the source is null_ptr.
  3. std::set: the target is not set to empty if the source is empty, and the target is not clear if the source is not empty ending up with elements from both source and target.
  4. std::list: the target is not set to empty if the source is empty, and the target is not clear if the source is not empty ending up with elements from both source and target.

The PR adds comprehensive tests for packing/unpacking std::optional, std::shared_ptr, std::set, and std::list.

Resolves #1103

@linh2931 linh2931 merged commit b045377 into main Jan 16, 2025
36 checks passed
@linh2931 linh2931 deleted the fix_unpack branch January 16, 2025 13:17
@ericpassmore
Copy link
Contributor

Note:start
category: System Stability
component: Internal
summary: Fix unpacking() issues for several standard types.
Note:end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fc::unpack() does not clear target for std::optional, std::shared_ptr, std::set, and std::list
4 participants