erikdoe / ocmock

Mock objects for Objective-C
http://ocmock.org
Apache License 2.0
2.16k stars 606 forks source link

objc_retain crash on testing framework whilst using [OCMArg anyPointer] #323

Closed pellet closed 4 years ago

pellet commented 7 years ago

This error popped up once I built my library as a framework rather than a static library. It could be due to some compilation settings differences. When I create a partial mock of an object via OCMPartialMock and stub an argument with [OCMArg anyPointer] I'm getting crashes on NSInvocation+OCMAdditions.m line 87:

[retainedArguments addObject:argument];

It looks like the code should be checking if the object is an [OCMArg anyPointer] and if so, not attempting to retain the argument, but this is just a guess. I managed to get around the crash by instead using [OCMArg isNotNil] which is a fine work around for the moment. Cheers, pellet.

erikdoe commented 7 years ago

Can you provide more information? Are you using the released binary distributions or are you building OCMock yourself? Does this only happen with partial mocks and not with regular mocks? Could you provide a failing test case and a stack trace?

erikdoe commented 4 years ago

Closing due to inactivity.