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

removed static ctors
author Frank Benoit <benoit@tionex.de>
date Wed, 06 Feb 2008 12:09:44 +0100
parents 205350493476
children 43c42c637c9c
line wrap: on
line diff
--- a/dwt/widgets/Table.d	Wed Feb 06 11:08:01 2008 +0100
+++ b/dwt/widgets/Table.d	Wed Feb 06 12:09:44 2008 +0100
@@ -110,12 +110,23 @@
     static const int VISTA_EXTRA = 2;
     static const int EXPLORER_EXTRA = 2;
     static const bool EXPLORER_THEME = true;
-    static const WNDPROC TableProc;
+    private static /+const+/ WNDPROC TableProc;
     static const TCHAR[] TableClass = OS.WC_LISTVIEW;
-    static this() {
-        WNDCLASS lpWndClass;
-        OS.GetClassInfo (null, TableClass.ptr, &lpWndClass);
-        TableProc = 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, TableClass.ptr, &lpWndClass);
+            TableProc = lpWndClass.lpfnWndProc;
+            static_this_completed = true;
+        }
     }
 
 /**
@@ -152,6 +163,7 @@
  * @see Widget#getStyle
  */
 public this (Composite parent, int style) {
+    static_this();
     super (parent, checkStyle (style));
 }