diff --git a/bazaar/GoogleTestExample/GoogleTestExample.upp b/bazaar/GoogleTestExample/GoogleTestExample.upp index a85aa4a74..8305d83c1 100644 --- a/bazaar/GoogleTestExample/GoogleTestExample.upp +++ b/bazaar/GoogleTestExample/GoogleTestExample.upp @@ -12,5 +12,6 @@ file main.cpp; mainconfig + "" = "USEMALLOC", "" = ""; diff --git a/bazaar/GoogleTestExample/main.cpp b/bazaar/GoogleTestExample/main.cpp index 2eac4eb4e..7b382f7a4 100644 --- a/bazaar/GoogleTestExample/main.cpp +++ b/bazaar/GoogleTestExample/main.cpp @@ -1,4 +1,3 @@ -#include #include int main(int argc, char *argv[]) diff --git a/bazaar/plugin/gtest/gtest-port.cc b/bazaar/plugin/gtest/gtest-port.cc index 35944e333..48d140fa7 100644 --- a/bazaar/plugin/gtest/gtest-port.cc +++ b/bazaar/plugin/gtest/gtest-port.cc @@ -31,6 +31,8 @@ #include "internal/gtest-port.h" +#include + #include #include #include @@ -289,7 +291,14 @@ void Mutex::ThreadSafeLazyInit() { // If critical_section_init_phase_ was 0 before the exchange, we // are the first to test it and need to perform the initialization. owner_thread_id_ = 0; + + // ---------------------------------------------------------- + // TODO FIXME: UPP leak ignoring + Upp::MemoryIgnoreLeaksBegin(); critical_section_ = new CRITICAL_SECTION; + Upp::MemoryIgnoreLeaksEnd(); + // ---------------------------------------------------------- + ::InitializeCriticalSection(critical_section_); // Updates the critical_section_init_phase_ to 2 to signal // initialization complete. @@ -531,8 +540,8 @@ class ThreadLocalRegistryImpl { // Returns map of thread local instances. static ThreadIdToThreadLocals* GetThreadLocalsMapLocked() { mutex_.AssertHeld(); - static ThreadIdToThreadLocals* map = new ThreadIdToThreadLocals; - return map; + static ThreadIdToThreadLocals map; + return ↦ } // Protects access to GetThreadLocalsMapLocked() and its return value. diff --git a/bazaar/plugin/gtest/gtest.upp b/bazaar/plugin/gtest/gtest.upp index 69c8f97d1..0dafeb640 100644 --- a/bazaar/plugin/gtest/gtest.upp +++ b/bazaar/plugin/gtest/gtest.upp @@ -1,5 +1,8 @@ description "Google C++ unite test framework\377"; +uses + Core; + library(POSIX) pthread; file diff --git a/bazaar/plugin/gtest/init b/bazaar/plugin/gtest/init index ddb7d07c5..ff36d3df1 100644 --- a/bazaar/plugin/gtest/init +++ b/bazaar/plugin/gtest/init @@ -1,3 +1,4 @@ #ifndef _plugin_gtest_icpp_init_stub #define _plugin_gtest_icpp_init_stub +#include "Core/init" #endif