In my code I have a class Log with a member function Push. Somewhere else I call this class function with an instance pLog->Push from a non-class function.
void some_stuff()
{
pLog->Push(...);
}
Doing this causes a SIGSEGV:
void Log::Push(const char *b)
{
std::lock_guard<std::mutex> lock(m_Mutex);
m_Messages.push_back(b); // std::deque<std::string>
}
When removing the mutex, another crash is invoked at m_Messages.push_back(b). After some research I found out that making the function some_stuff member of Log this crash does not occur. I even tried this on another g++ version (4.9) and it still happens.
Aucun commentaire:
Enregistrer un commentaire