sumanth krishna wrote:
C is a singleton class and from the logs i can see that the other threads have exited before the destructor of C is called.
Well, in this case you should try to isolate a complete program that crashes and post it here.
Even if the thread calls c->getList after ~C is executed, then also it should not cause a problem because until all the instances are deleted and reference count of the shared pointers reaches zero the memory for the allocated class should not be deleted.
No, destroying a shared_ptr in one thread and copying it from another doesn't work. Even if it did, destroying a std::list in one thread and iterating over it from another doesn't work either. If you access an object from more than one thread, all accesses must be read (non-modifying) accesses.