Skip to content
New issue

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

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

Already on GitHub? # to your account

fix: concurrency crash on item attributes #3304

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

dudantas
Copy link
Member

@dudantas dudantas commented Jan 29, 2025

Description

This PR refactors the Attributes class by replacing std::shared_ptr<std::string> with std::string in the value variant. The previous implementation introduced unnecessary heap allocations and potential crashes due to incorrect shared pointer management. The refactor ensures safer and more efficient handling of string attributes.

Behaviour

Actual

If an attribute stored a std::shared_ptr<std::string>, there were cases where the reference was lost or improperly accessed, leading to crashes when trying to retrieve the string.

Expected

Attributes now store std::string directly, preventing dangling pointers and reducing overhead related to shared pointer allocation and dereferencing.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested

  • Verified that all interactions using string attributes work correctly
  • Ensured that string retrievals no longer result in crashes
  • Tested attribute modifications and retrievals under various scenarios

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I checked the PR checks reports
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works

Copy link

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

Successfully merging this pull request may close these issues.

2 participants