diff dwtx/draw2d/TextUtilities.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/TextUtilities.d	Sun Aug 03 00:54:29 2008 +0200
+++ b/dwtx/draw2d/TextUtilities.d	Sun Aug 03 02:17:46 2008 +0200
@@ -33,12 +33,17 @@
     /**
      * a singleton default instance
      */
-    public static TextUtilities INSTANCE;
-
-    static this(){
-        INSTANCE = new TextUtilities();
+    private static TextUtilities INSTANCE_;
+    public static TextUtilities INSTANCE(){
+        if( INSTANCE_ is null ){
+            synchronized( TextUtilities.classinfo ){
+                if( INSTANCE_ is null ){
+                    INSTANCE_ = new TextUtilities();
+                }
+            }
+        }
+        return INSTANCE_;
     }
-
     /**
      * Returns the Dimensions of <i>s</i> in Font <i>f</i>.
      *