Skip to content

Commit 58897c6

Browse files
authored
Merge pull request #2503 from c1728p9/singleton_ptr_fix
Fix SingletonPtr problems
2 parents 4fd7154 + 707291a commit 58897c6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

hal/api/SingletonPtr.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@ struct SingletonPtr {
7676
T* get() {
7777
if (NULL == _ptr) {
7878
singleton_lock();
79-
_ptr = new (_data) T;
79+
if (NULL == _ptr) {
80+
_ptr = new (_data) T();
81+
}
8082
singleton_unlock();
8183
}
8284
// _ptr was not zero initialized or was

0 commit comments

Comments
 (0)