Ticket #2339: boost-destruction-order-fix.diff

File boost-destruction-order-fix.diff, 1.2 KB (added by Devin Bayer <web@…>, 14 years ago)

boost-destruction-order-fix.diff

  • boost/interprocess/segment_manager.hpp

    old new class segment_manager  
    11301130         if(!buffer_ptr)
    11311131            return 0;
    11321132      }
     1133     
     1134      //Build scoped ptr to avoid leaks with constructor exception
     1135      //Memory can only be deallocated after the node is erased
     1136      detail::mem_algo_deallocator<segment_manager_base_type> mem
     1137         (buffer_ptr, *static_cast<segment_manager_base_type*>(this));
     1138
    11331139
    11341140      //Now construct the intrusive hook plus the header
    11351141      intrusive_value_type * intrusive_hdr = new(buffer_ptr) intrusive_value_type();
    class segment_manager  
    11571163      //if something goes wrong
    11581164      value_eraser<index_type> v_eraser(index, it);
    11591165     
    1160       //Avoid constructions if constructor is trivial
    1161       //Build scoped ptr to avoid leaks with constructor exception
    1162       detail::mem_algo_deallocator<segment_manager_base_type> mem
    1163          (buffer_ptr, *static_cast<segment_manager_base_type*>(this));
    1164 
    11651166      //Construct array, this can throw
    11661167      detail::array_construct(ptr, num, table);
    11671168