webengine/osswebengine/JavaScriptCore/kjs/regexp_object.cpp
changeset 5 10e98eab6f85
parent 0 dd21522fd290
--- a/webengine/osswebengine/JavaScriptCore/kjs/regexp_object.cpp	Fri May 08 08:25:06 2009 +0300
+++ b/webengine/osswebengine/JavaScriptCore/kjs/regexp_object.cpp	Fri Jul 03 15:54:40 2009 +0100
@@ -43,13 +43,31 @@
 
 const ClassInfo RegExpPrototype::info = {"RegExpPrototype", 0, 0, 0};
 
+    static const Identifier* execPropertyName = 0; 
+    static const Identifier* testPropertyName = 0; 
+ 
+
+    struct cleanupStaticRegexpObject { 
+        ~cleanupStaticRegexpObject()  
+       { 
+          delete execPropertyName; 
+          delete testPropertyName; 
+	 
+          execPropertyName = 0; 
+          testPropertyName = 0; 
+        } 
+   }; 
+   static cleanupStaticRegexpObject deleteStaticRegexpObject; 
+
 RegExpPrototype::RegExpPrototype(ExecState *exec,
                                        ObjectPrototype *objProto,
                                        FunctionPrototype *funcProto)
   : JSObject(objProto)
 {
-  static const Identifier* execPropertyName = new Identifier("exec");
-  static const Identifier* testPropertyName = new Identifier("test");
+  if(!execPropertyName)
+		execPropertyName = new Identifier("exec");
+  if(!testPropertyName)
+        testPropertyName = new Identifier("test");
 
   putDirectFunction(new RegExpProtoFunc(exec, funcProto, RegExpProtoFunc::Exec, 0, *execPropertyName), DontEnum);
   putDirectFunction(new RegExpProtoFunc(exec, funcProto, RegExpProtoFunc::Test, 0, *testPropertyName), DontEnum);