#15 bug in destructor order when using a static Json::Value

Value (7)

When using a static instance of Json::Value, it may destruct after the DefaultValueAllocator does; therefore, when it calls valueAllocator()->releaseStringValue(), the valueAllocator() is already destructed and chaos ensues.

I have fixed it by representing the fact that a Value has an implicit dependency on a given instance of ValueAllocator by giving it a ValueAllocatorHandle which is just reference counted and takes care of deleting a heap allocated allocator when the last Value goes out of scope.

My patch to do this is attached.


  • zeromus

    zeromus - 2010-01-18

    patch to refcount ValueAllocator instances

  • Baptiste Lepilleur

    Plan is to remove allocator completly. They introduce too many issue with little gain.

  • Baptiste Lepilleur

    • labels: --> Value
    • milestone: --> 0.5.0
    • assigned_to: nobody --> blep
    • status: open --> open-remind
  • Baptiste Lepilleur

    Fixed in trunk:
    Removed experimental ValueAllocator, it caused static initialization/destruction order issues (bug #2934500). The DefaultValueAllocator has been inlined in code.

  • Baptiste Lepilleur

    • status: open-remind --> closed-fixed

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks