Menu

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

0.5.0
closed-fixed
Value (7)
5
2010-03-13
2010-01-18
zeromus
No

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.

Discussion

  • 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
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.