Skip to content

Conversation

dmaclach
Copy link
Contributor

Previous code would only catch references to self when using the OCMStub/OCMExpect macros.
Now we avoid self referential retain loops if you use the [[[foo stub] andReturn:foo] sharedInstance] API.

Previous code would only catch references to self when using the OCMStub/OCMExpect macros.
Now we avoid self referential retain loops if you use the `[[[foo stub] andReturn:foo] sharedInstance]` API.
{
[[self stub] addInvocationAction:[[[OCMNonRetainingObjectReturnValueProvider alloc] initWithValue:mockObject] autorelease]];
return self;
return self;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am going to merge this PR as is. In future, though, please don't make whitespace changes. I know that inconsistencies have crept in over the years, but cleaning them up like this adds noise to the real change. Thanks.

@erikdoe erikdoe merged commit 195ac33 into erikdoe:master Mar 26, 2020
@twitterkb
Copy link

i would like to revert this change. this has caused a regression in a long-standing test that we've had that performs a id mock = [OCMockObject niceMockForClass:MyClass] where the mock performs a [[[mock stub] andReturn:mock] sharedInstance] .

how would you feel about me submitting a pull-request to revert this? i will be glad to further test any follow-up changes. cc @erikdoe @dmaclach ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants