Mercurial > projects > dwt-addons
diff dwtx/draw2d/Polyline.d @ 103:2d6540440fe6
Replace static ctors with lazy init.
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 03 Aug 2008 17:01:51 +0200 |
parents | 95307ad235d9 |
children |
line wrap: on
line diff
--- a/dwtx/draw2d/Polyline.d Sun Aug 03 03:07:30 2008 +0200 +++ b/dwtx/draw2d/Polyline.d Sun Aug 03 17:01:51 2008 +0200 @@ -38,11 +38,18 @@ PointList points; private int tolerance = 2; -private static const Rectangle LINEBOUNDS; -static this(){ - LINEBOUNDS = Rectangle.SINGLETON; - assert( LINEBOUNDS !is null ); +private static Rectangle LINEBOUNDS_; +private static Rectangle LINEBOUNDS(){ + if( LINEBOUNDS_ is null ){ + synchronized( Polyline.classinfo ){ + if( LINEBOUNDS_ is null ){ + LINEBOUNDS_ = Rectangle.SINGLETON; + assert( LINEBOUNDS !is null ); + } + } + } + return LINEBOUNDS_; } this(){