Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • A ArduinoJson
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 24
    • Issues 24
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Benoît Blanchon
  • ArduinoJson
  • Issues
  • #1126
Closed
Open
Issue created Nov 05, 2019 by Administrator@rootContributor

6.13.0 broken for non-copy-constructable String types

Created by: mikee47

With commit 6da6f921 both ElementProxy and MemberProxy take copies of the TString argument instead of taking a reference.

This breaks existing code which depends upon the referencing behaviour, and also has performance/efficiency implications.

The fault addressed by the above commit is briefly outlined in #1120 (closed), caused by a dangling reference. To clarify, this is where the ElementProxy/MemberProxy take a reference to a temporary object (e.g. arduino String) which the compiler optimises out before the reference is used. This leads to unpredictable behaviour, so clearly taking proper copies is the safest (default) behaviour.

However, I have a custom FlashString class (with adapter) which is not copy-constructible and so now no longer works as intended.

Here are the details:

  • FlashString
  • ArduinoJson FlashStringRefAdapter

I've been unable to find a workable solution without modifying ArduinoJson so I'll propose that and see where we go.

It feels like there's room for improvement here. Can we detect when it's safe to take a reference, and do that when possible?

Assignee
Assign to
Time tracking