On 11/22/2014 03:19 AM, Abdelrazak Younes wrote:
On 20/11/2014 21:04, Georg Baum wrote:
I don't think so in this case. The crash happens because internal
std::basic_string members are corrupt, and it is almost always a string
created from Language::babel_. Furthermore, I was not able to reproduce the
crash after changing

std::string const & babel() const { return babel_; }

to

std::string const babel() const { return babel_.c_str(); }

in Language.h (which circumvents copy-on-write).

Hum, well, maybe Language object is shared between the buffer clones?

In BufferParams.h:
    ///
    Language const * language;

That could well explain the issue... babel_ is accessed at the same time between 2 threads which creates a race condition.

So my solution would be to protect the Language object through a mutex.

If I am right then this crash is due to a flow in our design, not in the STL string.

I'm not as well informed as you and others about these sorts of issues. Why would simply having two threads reading the babel_ string at the same time cause this sort of problem? We shouldn't have write access to the language object from the Buffer.

Richard

Reply via email to