diff dwtx/draw2d/graph/Subgraph.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/graph/Subgraph.d	Sun Aug 03 03:07:30 2008 +0200
+++ b/dwtx/draw2d/graph/Subgraph.d	Sun Aug 03 17:01:51 2008 +0200
@@ -65,10 +65,19 @@
  */
 public Insets innerPadding;
 
-private static const Insets NO_INSETS;
-static this(){
-    NO_INSETS = new Insets();
+private static Insets NO_INSETS_;
+private static Insets NO_INSETS(){
+    if( NO_INSETS_ is null ){
+        synchronized( Subgraph.classinfo ){
+            if( NO_INSETS_ is null ){
+                NO_INSETS_ = new Insets();
+            }
+        }
+    }
+    assert( NO_INSETS_ );
+    return NO_INSETS_;
 }
+
 /**
  * Constructs a new subgraph with the given data object.
  * @see Node#Node(Object)