Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
yangql
googletest
Commits
7c95d834
Commit
7c95d834
authored
Oct 01, 2009
by
zhanyong.wan
Browse files
Works around a Symbian compiler bug that causes memory leak (by Mika Raento).
parent
79643f51
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
3 deletions
+18
-3
include/gmock/gmock-spec-builders.h
include/gmock/gmock-spec-builders.h
+10
-3
src/gmock-spec-builders.cc
src/gmock-spec-builders.cc
+8
-0
No files found.
include/gmock/gmock-spec-builders.h
View file @
7c95d834
...
@@ -351,10 +351,18 @@ class Mock {
...
@@ -351,10 +351,18 @@ class Mock {
// - Constness is shallow: a const Expectation object itself cannot
// - Constness is shallow: a const Expectation object itself cannot
// be modified, but the mutable methods of the ExpectationBase
// be modified, but the mutable methods of the ExpectationBase
// object it references can be called via expectation_base().
// object it references can be called via expectation_base().
// - The constructors and destructor are defined out-of-line because
// the Symbian WINSCW compiler wants to otherwise instantiate them
// when it sees this class definition, at which point it doesn't have
// ExpectationBase available yet, leading to incorrect destruction
// in the linked_ptr (or compilation errors if using a checking
// linked_ptr).
class
Expectation
{
class
Expectation
{
public:
public:
// Constructs a null object that doesn't reference any expectation.
// Constructs a null object that doesn't reference any expectation.
Expectation
()
{}
Expectation
();
~
Expectation
();
// This single-argument ctor must not be explicit, in order to support the
// This single-argument ctor must not be explicit, in order to support the
// Expectation e = EXPECT_CALL(...);
// Expectation e = EXPECT_CALL(...);
...
@@ -399,8 +407,7 @@ class Expectation {
...
@@ -399,8 +407,7 @@ class Expectation {
typedef
::
std
::
set
<
Expectation
,
Less
>
Set
;
typedef
::
std
::
set
<
Expectation
,
Less
>
Set
;
Expectation
(
Expectation
(
const
internal
::
linked_ptr
<
internal
::
ExpectationBase
>&
expectation_base
)
:
const
internal
::
linked_ptr
<
internal
::
ExpectationBase
>&
expectation_base
);
expectation_base_
(
expectation_base
)
{}
// Returns the expectation this object references.
// Returns the expectation this object references.
const
internal
::
linked_ptr
<
internal
::
ExpectationBase
>&
const
internal
::
linked_ptr
<
internal
::
ExpectationBase
>&
...
...
src/gmock-spec-builders.cc
View file @
7c95d834
...
@@ -420,6 +420,14 @@ void Mock::ClearDefaultActionsLocked(void* mock_obj) {
...
@@ -420,6 +420,14 @@ void Mock::ClearDefaultActionsLocked(void* mock_obj) {
// needed by VerifyAndClearExpectationsLocked().
// needed by VerifyAndClearExpectationsLocked().
}
}
Expectation
::
Expectation
()
{}
Expectation
::
Expectation
(
const
internal
::
linked_ptr
<
internal
::
ExpectationBase
>&
expectation_base
)
:
expectation_base_
(
expectation_base
)
{}
Expectation
::~
Expectation
()
{}
// Adds an expectation to a sequence.
// Adds an expectation to a sequence.
void
Sequence
::
AddExpectation
(
const
Expectation
&
expectation
)
const
{
void
Sequence
::
AddExpectation
(
const
Expectation
&
expectation
)
const
{
if
(
*
last_expectation_
!=
expectation
)
{
if
(
*
last_expectation_
!=
expectation
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment