diff dwt/widgets/List.d @ 80:1801ddeb8f32

removed static ctors
author Frank Benoit <benoit@tionex.de>
date Wed, 06 Feb 2008 12:09:44 +0100
parents 1bc7c2131617
children 43c42c637c9c
line wrap: on
line diff
--- a/dwt/widgets/List.d	Wed Feb 06 11:08:01 2008 +0100
+++ b/dwt/widgets/List.d	Wed Feb 06 12:09:44 2008 +0100
@@ -51,12 +51,23 @@
     alias Scrollable.windowProc windowProc;
 
     static const int INSET = 3;
-    static const WNDPROC ListProc;
+    private static /+const+/ WNDPROC ListProc;
     static const TCHAR[] ListClass = "LISTBOX";
-    static this() {
-        WNDCLASS lpWndClass;
-        OS.GetClassInfo (null, ListClass.ptr, &lpWndClass);
-        ListProc = lpWndClass.lpfnWndProc;
+
+    private static bool static_this_completed = false;
+    private static void static_this() {
+        if( static_this_completed ){
+            return;
+        }
+        synchronized {
+            if( static_this_completed ){
+                return;
+            }
+            WNDCLASS lpWndClass;
+            OS.GetClassInfo (null, ListClass.ptr, &lpWndClass);
+            ListProc = lpWndClass.lpfnWndProc;
+            static_this_completed = true;
+        }
     }
 
 /**
@@ -89,6 +100,7 @@
  * @see Widget#getStyle
  */
 public this (Composite parent, int style) {
+    static_this();
     super (parent, checkStyle (style));
 }
 /**