Returning shared_ptr to mock from expectation hangs in Linux
Closed this issue · 4 comments
GoogleCodeExporter commented
What steps will reproduce the problem?
1. Compile and run code in main.cpp
What is the expected output? What do you see instead?
Expected output is for application to exit. Application never exits.
Which version of Google Mock are you using? On what operating system?
googlemock/src$ svn info
Path: .
URL: http://googlemock.googlecode.com/svn/trunk/src
Repository Root: http://googlemock.googlecode.com/svn
Repository UUID: 8415998a-534a-0410-bf83-d39667b30386
Revision: 300
Node Kind: directory
Schedule: normal
Last Changed Author: zhanyong.wan
Last Changed Rev: 294
Last Changed Date: 2010-05-10 13:14:29 -0400 (Mon, 10 May 2010)
Original issue reported on code.google.com by tim.dave@gmail.com
on 2 Jun 2010 at 7:44
- Merged into: #79
Attachments:
GoogleCodeExporter commented
This is the same as issue 79. A work around is to switch the definition of
objectA
and objectB.
Original comment by w...@google.com
on 2 Jun 2010 at 7:59
- Changed state: Duplicate
GoogleCodeExporter commented
An extremely helpful comment!
Original comment by zilvinas...@gmail.com
on 25 Oct 2010 at 1:18
GoogleCodeExporter commented
Can't make it work this workaround. My real example is a bit complex but in
general I've got the same problem. When I'm invoking method which should take
argument boost::shared_ptr of mocked class (body is nothing more than mock of
base intereface), whole results hang. Do you have any suggestions?
Original comment by darek.be...@gmail.com
on 16 Jul 2011 at 11:32
GoogleCodeExporter commented
I found that manually reset()'ing shared_ptr instances to mocks that I use in a
test case works around the problem:
TEST(SomeTest, someCase) {
auto mock = make_shared<MockObject>();
// Pass shared_ptr somewhere ...
mock.reset();
}
Original comment by denis.a....@gmail.com
on 16 Feb 2013 at 2:04