.bazaar fixed plugin/gtest memory leaks on MS Windows

git-svn-id: svn://ultimatepp.org/upp/trunk@9430 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
klugier 2016-01-23 18:17:59 +00:00
parent c389aaee6e
commit 8d56e81392
5 changed files with 16 additions and 3 deletions

View file

@ -12,5 +12,6 @@ file
main.cpp;
mainconfig
"" = "USEMALLOC",
"" = "";

View file

@ -1,4 +1,3 @@
#include <iostream>
#include <plugin/gtest/gtest.h>
int main(int argc, char *argv[])

View file

@ -31,6 +31,8 @@
#include "internal/gtest-port.h"
#include <Core/Core.h>
#include <limits.h>
#include <stdlib.h>
#include <stdio.h>
@ -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 &map;
}
// Protects access to GetThreadLocalsMapLocked() and its return value.

View file

@ -1,5 +1,8 @@
description "Google C++ unite test framework\377";
uses
Core;
library(POSIX) pthread;
file

View file

@ -1,3 +1,4 @@
#ifndef _plugin_gtest_icpp_init_stub
#define _plugin_gtest_icpp_init_stub
#include "Core/init"
#endif