diff dwtx/draw2d/widgets/MultiLineLabel.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/widgets/MultiLineLabel.d	Sun Aug 03 03:07:30 2008 +0200
+++ b/dwtx/draw2d/widgets/MultiLineLabel.d	Sun Aug 03 17:01:51 2008 +0200
@@ -49,12 +49,19 @@
 public final class MultiLineLabel : FigureCanvas {
 
 private TextFlow textFlow;
-static const Border MARGIN;
-private Image image;
+private static Border MARGIN_;
+static Border MARGIN(){
+    if( MARGIN_ is null ){
+        synchronized( MultiLineLabel.classinfo ){
+            if( MARGIN_ is null ){
+                MARGIN_ = new MarginBorder(2);
+            }
+        }
+    }
+    return MARGIN_;
+}
 
-static this(){
-    MARGIN = new MarginBorder(2);
-}
+private Image image;
 
 class FocusableViewport : Viewport {
     this() {