Mercurial > projects > dwt-addons
diff dwtx/draw2d/AbstractBorder.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/AbstractBorder.d Sun Aug 03 03:07:30 2008 +0200 +++ b/dwtx/draw2d/AbstractBorder.d Sun Aug 03 17:01:51 2008 +0200 @@ -29,14 +29,29 @@ : Border { -private static const Dimension EMPTY; +private static Dimension EMPTY_; +private static Dimension EMPTY(){ + if( EMPTY_ is null ){ + synchronized( AbstractBorder.classinfo ){ + if( EMPTY_ is null ){ + EMPTY_ = new Dimension(); + } + } + } + return EMPTY_; +} /** A temporary Rectangle*/ -protected static Rectangle tempRect; - -static this(){ - EMPTY = new Dimension(); - tempRect = new Rectangle(); +private static Rectangle tempRect_; +protected static Rectangle tempRect(){ + if( tempRect_ is null ){ + synchronized( AbstractBorder.classinfo ){ + if( tempRect_ is null ){ + tempRect_ = new Rectangle(); + } + } + } + return tempRect_; } /**