Index: code/branches/cpp11_v2/test/core/command/FunctorTest.cc
===================================================================
--- code/branches/cpp11_v2/test/core/command/FunctorTest.cc	(revision 10922)
+++ code/branches/cpp11_v2/test/core/command/FunctorTest.cc	(revision 10975)
@@ -19,4 +19,10 @@
         };
 
+        class DestroyableClass : public Destroyable
+        {
+	        public:
+	            void method() {};
+        };
+
         void f1(int, double)
         {
@@ -31,4 +37,13 @@
             return 0;
         }
+
+        struct CallableStruct
+        {
+	        public:
+	            int operator()()
+	            {
+	                return 1;
+	            }
+        };
     }
 
@@ -38,11 +53,11 @@
         FunctorPtr fp2 = createFunctor(&f2);
         FunctorPtr fp3 = createFunctor(&f3);
-        ASSERT_TRUE(fp1->getHeaderIdentifier(1) == fp2->getHeaderIdentifier(1));
-        ASSERT_TRUE(fp1->getHeaderIdentifier(2) == fp2->getHeaderIdentifier(2));
-        ASSERT_FALSE(fp1->getHeaderIdentifier(1) == fp2->getHeaderIdentifier(2));
-        ASSERT_FALSE(fp1->getHeaderIdentifier(10) == fp2->getHeaderIdentifier(10));
-        ASSERT_FALSE(fp2->getHeaderIdentifier(2) == fp3->getHeaderIdentifier(2));
-        ASSERT_FALSE(fp1->getHeaderIdentifier() == fp2->getHeaderIdentifier());
-        ASSERT_FALSE(fp2->getHeaderIdentifier() == fp3->getHeaderIdentifier());
+        ASSERT_STREQ(fp1->getHeaderIdentifier(1).name(), fp2->getHeaderIdentifier(1).name());
+        ASSERT_STREQ(fp1->getHeaderIdentifier(2).name(), fp2->getHeaderIdentifier(2).name());
+        ASSERT_STRNE(fp1->getHeaderIdentifier(1).name(), fp2->getHeaderIdentifier(2).name());
+        ASSERT_STRNE(fp1->getHeaderIdentifier(10).name(), fp2->getHeaderIdentifier(10).name());
+        ASSERT_STRNE(fp2->getHeaderIdentifier(2).name(), fp3->getHeaderIdentifier(2).name());
+        ASSERT_STRNE(fp1->getHeaderIdentifier().name(), fp2->getHeaderIdentifier().name());
+        ASSERT_STRNE(fp2->getHeaderIdentifier().name(), fp3->getHeaderIdentifier().name());
     }
 
@@ -52,6 +67,6 @@
         FunctorPtr fp2 = createFunctor(&f2);
         FunctorPtr fp3 = createFunctor(&f3);
-        ASSERT_TRUE(fp1->getTypenameReturnvalue() == fp2->getTypenameReturnvalue());
-        ASSERT_TRUE(fp1->getTypenameParam(0) == fp3->getTypenameParam(0));
+        ASSERT_EQ(fp1->getTypenameReturnvalue(), fp2->getTypenameReturnvalue());
+        ASSERT_EQ(fp1->getTypenameParam(0), fp3->getTypenameParam(0));
         ASSERT_EQ("void", fp1->getTypenameReturnvalue());
         ASSERT_EQ("int", fp3->getTypenameReturnvalue());
@@ -67,5 +82,5 @@
         FunctorPtr fp3 = createFunctor(&f3);
         ASSERT_EQ(3, fp2->getParamCount());
-        ASSERT_FALSE(fp1->getParamCount() == fp3->getParamCount());
+        ASSERT_NE(fp1->getParamCount(), fp3->getParamCount());
         ASSERT_FALSE(fp2->hasReturnvalue());
         ASSERT_TRUE(fp3->hasReturnvalue());
@@ -86,3 +101,45 @@
         ASSERT_TRUE(mttype.null());
     }
+
+    TEST_F(FunctorTest, canUseCallables)
+    {
+        int a = 0;
+        FunctorPtr fp1 = createFunctor(CallableStruct{});
+        FunctorPtr fp2 = createFunctor([](bool val) { return val; });
+        FunctorPtr fp3 = createFunctor([&a]() {return a++; });
+        FunctorPtr fp4 = createFunctor([a]() {return a; });
+        ASSERT_EQ(1, (*fp1)().get<int>());
+        ASSERT_EQ(true, (*fp2)(true).get<bool>());
+        ASSERT_EQ(0, (*fp3)().get<int>());
+        ASSERT_EQ(1, a);
+        ASSERT_EQ(0, (*fp4)().get<int>());
+        ASSERT_STREQ(fp1->getHeaderIdentifier().name(), fp3->getHeaderIdentifier().name());
+    }
+
+    TEST_F(FunctorTest, SafeModeWorks)
+    {
+        DestroyableClass* testclass = new DestroyableClass();
+        DestroyableClass* testclass2 = new DestroyableClass();
+        FunctorPtr fp1 = createFunctor(&DestroyableClass::method, testclass);
+        fp1->setSafeMode(true);
+        FunctorPtr fp2 = createFunctor(&DestroyableClass::method, testclass);
+        fp2->setSafeMode(true);
+        FunctorPtr fp3 = createFunctor(&DestroyableClass::method, testclass);
+        fp2->setRawObjectPointer(testclass2);
+
+        ASSERT_NE(nullptr, fp1->getRawObjectPointer());
+        ASSERT_NE(nullptr, fp2->getRawObjectPointer());
+        ASSERT_NE(nullptr, fp3->getRawObjectPointer());
+        testclass->destroy();
+        ASSERT_EQ(nullptr, fp1->getRawObjectPointer());
+        ASSERT_NE(nullptr, fp2->getRawObjectPointer());
+        ASSERT_NE(nullptr, fp3->getRawObjectPointer());
+
+        fp3->setRawObjectPointer(testclass2);
+        fp3->setSafeMode(true);
+        fp2->setSafeMode(false);
+        testclass2->destroy();
+        ASSERT_NE(nullptr, fp2->getRawObjectPointer());
+        ASSERT_EQ(nullptr, fp3->getRawObjectPointer());
+    }
 }
