cc y / mbed

Fork of mbed by mbed official

Revision:
125:2e9cc70d1897
Parent:
123:b0220dba8be7
--- a/SingletonPtr.h	Fri Aug 19 10:17:11 2016 +0100
+++ b/SingletonPtr.h	Wed Aug 31 18:09:46 2016 +0100
@@ -76,7 +76,9 @@
     T* get() {
         if (NULL == _ptr) {
             singleton_lock();
-            _ptr = new (_data) T;
+            if (NULL == _ptr) {
+                _ptr = new (_data) T();
+            }
             singleton_unlock();
         }
         // _ptr was not zero initialized or was