[Libreoffice-commits] core.git: drawinglayer/source svx/source

Caolán McNamara caolanm at redhat.com
Thu May 2 03:18:00 PDT 2013


On Tue, 2013-04-30 at 12:17 +0200, Thorsten Behrens wrote:
> > diff --git a/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx b/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx
> > index 77487db..495c06f 100644
> > --- a/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx
> > +++ b/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx
> > @@ -42,9 +42,10 @@ namespace drawinglayer
> >                  static Primitive3DSequence aLineTubeList;
> >                  static sal_uInt32 nLineTubeSegments(0L);
> >                  static attribute::MaterialAttribute3D aLineMaterial;
> > +                static ::osl::Mutex aMutex;
> >  
> >                  // may exclusively change static data, use mutex
> > -                ::osl::Mutex m_mutex;
> > +                ::osl::MutexGuard aGuard(aMutex);
> >  
> Thanks a lot for that cleanup!
> 
> There are two more instances of that kind in this file though, and
> beyond that - anyone eager to replace this with proper rtl::Static
> (with the benefit of much faster subsequent access to the statics)?
> 
> Usage is rather nicely documented in include/rtl/instance.hxx - for
> this case, StaticWithInit seems ideal.

Seeing as the statics in there aren't read-only init-once type of
things, but rather modifyable things the lock taken when they get
potentially modified needs to remain.

I wrapped up those related statics into classes and made safe singletons
of those, and locked their get_modified_cache_thingies as
http://cgit.freedesktop.org/libreoffice/core/commit/?id=92e5232dcbda1696a0e7c05defb3b6a00f4abdd7

C.




More information about the LibreOffice mailing list