[Libreoffice] Multiple issues with cppuhelper/source/exc_thrower.cxx

Bjoern Michaelsen bjoern.michaelsen at canonical.com
Fri May 27 03:34:01 PDT 2011


Hi Caolán,

On Fri, 27 May 2011 11:02:28 +0100
Caolán McNamara <caolanm at redhat.com> wrote:

> Well, if we look at the original code, given that s_pThrower is just a
> normal local variable set to 0, then we *always* enter the first if,
> and the first if always takes a MutexGuard from the global mutex, so
> we always lock inside the first branch, which is the only one
> executed.

right.
 
> So the original code doesn't do what it apparently thought it was
> doing of using a double-check lock, but ends up using a unconditional
> mutex lock every time, so it should be ok on all platforms/compilers,
> no ?

If the stuff protected protected by the mutex has no side effects, yes.
If it has, the code would be executed twice -- although neatly
serialized by the mutex. Now gcc with bug 13684 fixed should never init
the static variable twice, so even if the ctor has side effects, it
would not hurt. And the pointer assignment is atomic and has no side
effects.

> I think, given the unconditional mutex lock that it should be ok as it
> stands for 3-4.

Unless a compiler does not keep static variables threadsafe and the
ctor has side effects (I have not looked at that yet).

> Is the crash reproducible for you in any way ? It'd be much more
> confident with a reproducible scenario we could run under valgrind.

Unfortunately not. Various descriptions:
- Returning to a document after 10 hours
- Calc crash, high CPU load from other apps
- crashed while opening one writer and one calc document

Most of these just point to high load -- of course exceptions are more
likely then.
 
> As an aside, what gcc is in use ?

gcc (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2

Best,

Bjoern

-- 
https://launchpad.net/~bjoern-michaelsen




More information about the LibreOffice mailing list