Revert "[Tizen] Add codes for Dali Windows Backend"
[platform/core/uifw/dali-core.git] / dali / public-api / signals / callback.cpp
index 7b61117..6bbf33f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -25,8 +25,8 @@ namespace Dali
 // CallbackBase
 
 CallbackBase::CallbackBase()
-: mImpl( 0 ),
-  mFunction( 0 )
+: mImpl( NULL ),
+  mFunction( NULL )
 {
 }
 
@@ -36,7 +36,7 @@ CallbackBase::~CallbackBase()
 }
 
 CallbackBase::CallbackBase( Function function )
-: mImpl( 0 ),
+: mImpl( NULL ),
   mFunction( function )
 {
 }
@@ -45,18 +45,24 @@ CallbackBase::CallbackBase( void* object, MemberFunction function, Dispatcher di
 : mMemberFunction( function )
 {
   mImpl = new CallbackBase::Impl;
-  mImpl->mObjectPointer = object;
-  mImpl->mMemberFunctionDispatcher = dispatcher;
-  mImpl->mDestructorDispatcher = 0; // object is not owned
+  if( mImpl )
+  {
+    mImpl->mObjectPointer = object;
+    mImpl->mMemberFunctionDispatcher = dispatcher;
+    mImpl->mDestructorDispatcher = NULL; // object is not owned
+  }
 }
 
 CallbackBase::CallbackBase( void* object, MemberFunction function, Dispatcher dispatcher, Destructor destructor )
 : mMemberFunction( function )
 {
   mImpl = new CallbackBase::Impl;
-  mImpl->mObjectPointer = object;
-  mImpl->mMemberFunctionDispatcher = dispatcher;
-  mImpl->mDestructorDispatcher = destructor; // object is owned
+  if( mImpl )
+  {
+    mImpl->mObjectPointer = object;
+    mImpl->mMemberFunctionDispatcher = dispatcher;
+    mImpl->mDestructorDispatcher = destructor; // object is owned
+  }
 }
 
 void CallbackBase::Reset()
@@ -72,18 +78,18 @@ void CallbackBase::Reset()
     }
 
     delete mImpl;
-    mImpl = 0;
+    mImpl = NULL;
   }
 
-  mFunction = 0;
+  mFunction = NULL;
 }
 
 // CallbackBase::Impl
 
 CallbackBase::Impl::Impl()
-: mObjectPointer( 0 ),
-  mMemberFunctionDispatcher( 0 ),
-  mDestructorDispatcher( 0 )
+: mObjectPointer( NULL ),
+  mMemberFunctionDispatcher( NULL ),
+  mDestructorDispatcher( NULL )
 {
 }