So i got the variable
std::map<std::string, std::shared_ptr<MyClass>> m_map;
During the program shutdown routine, I'd like to exploit the wonderful smart pointer property which should (if I'm not wrong) take care of the destruction of MyClass instances, once their own last reference is destroyed.
So I'm just calling m_map.clear(), but this
- SOMETIME produces the aforementioned - corrupted double-linked list
- while in other cases (unknown thus uncontrolled variable) works correctly, 
- and finally in other cases (controlled variable; in facts, different program configuration) produces - terminate called after throwing an instance of 'std::runtime_error*'
I'd gladly receive at least some hint on approaches to the problem. Since the program is strongly multithreaded (and I know very little of it) I'm wondering if the deletion of that pointer to MyClass instance would interfere with something else.
 
     
    