Skip to content

Commit

Permalink
refs #6279. Deadlock issue in Gmock 1.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
OwenArnold committed Dec 11, 2012
1 parent 9d20f58 commit 2411bb6
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Code/Mantid/TestingTools/gmock-1.6.0/src/gmock-spec-builders.cc
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,16 @@ bool UntypedFunctionMockerBase::VerifyAndClearExpectationsLocked() {
untyped_expectation->line(), ss.str());
}
}
untyped_expectations_.clear();

// Swap data with empty to safely clear it outside mutex
UntypedExpectations tmp_untyped_expectations;
tmp_untyped_expectations.swap(untyped_expectations_);

// Unlock global mutex to avoid deadlock in nested destructors
g_gmock_mutex.Unlock();
tmp_untyped_expectations.clear();
g_gmock_mutex.Lock();

return expectations_met;
}

Expand Down

0 comments on commit 2411bb6

Please sign in to comment.