You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using the above versions, when initializing an OCMPartialMock with an NSConstantArray, it results in an EXC_BAD_ACCESS crash in -[OCPartialMockObject prepareObjectForInstanceMethodMocking] on line 160 of OCPartialMockObject.m.
I can repreduce the crash, with a different stack trace. Not sure what to do here. It feels like another optimisation in the runtime, which makes immutable arrays somehow special so that the setup and clean up doesn't work as expected for them.
One option would be to add a check for immutable arrays and consider it an error when a test tries to create a partial mock for an immutable array (which is a questionable thing to do anyway).
By the way, to my knowledge there is no NSConstantArray. The only thing that's publicly visible is NSArray and NSMutableArray. At runtime you'll also see classes like __NSArrayI.
OCMock 3.9.1
Xcode 14.0 beta 3 (14A5270f)
Using the above versions, when initializing an
OCMPartialMock
with anNSConstantArray
, it results in anEXC_BAD_ACCESS
crash in-[OCPartialMockObject prepareObjectForInstanceMethodMocking]
on line 160 ofOCPartialMockObject.m
.Here is an example that reproduces the crash:
Modifying the code to use an
NSArray
instead of anNSConstantArray
does not crash:The text was updated successfully, but these errors were encountered: