diff dwtx/draw2d/geometry/Dimension.d @ 101:1082a0fc2bb8

First Draw2D example running
author Frank Benoit <benoit@tionex.de>
date Sun, 03 Aug 2008 02:17:46 +0200
parents 95307ad235d9
children
line wrap: on
line diff
--- a/dwtx/draw2d/geometry/Dimension.d	Sun Aug 03 00:54:29 2008 +0200
+++ b/dwtx/draw2d/geometry/Dimension.d	Sun Aug 03 02:17:46 2008 +0200
@@ -31,10 +31,16 @@
 {
 
 /**A singleton for use in short calculations.  Use to avoid newing unnecessary objects.*/
-public static const Dimension SINGLETON;
-
-static this(){
-    SINGLETON = new Dimension();
+private static Dimension SINGLETON_;
+public static Dimension SINGLETON(){
+    if( SINGLETON_ is null ){
+        synchronized( Dimension.classinfo ){
+            if( SINGLETON_ is null ){
+                SINGLETON_ = new Dimension();
+            }
+        }
+    }
+    return SINGLETON_;
 }
 
 /**The width.*/