Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed reference count underflow runtime errors originating from Regex…

…KitLite.

The problem seems to be connected to using RegexKitLite in garbage collected environment. Pinpointed it by setting the breakpoint to auto_refcount_underflow_error and debugging in Xcode. This is a quick fix and should be tested to proove nothing leaks, but as the utility has short life span, it shouldn't do much harm...

Here's excerpt from Apple's Garbage Collection Programming Guide, Using Core Foundation with Garbage Collection section: "Conversely, using CFRelease to release an object you have previously retained using retain will result in a reference count underflow error".
  • Loading branch information...
commit e43b169e203096d592671c8900a1b6f5f70f7a8d 1 parent 6c5c5e4
@tomaz authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  Common/ThirdParty/RegexKitLite/RegexKitLite.m
View
2  Common/ThirdParty/RegexKitLite/RegexKitLite.m
@@ -387,7 +387,7 @@
// The split strings are created, but not autoreleased. The (immutable) array is created using these callbacks, which skips the CFRetain() call, effectively transferring ownership to the CFArray object.
// For each split string this saves the overhead of an autorelease, then an array retain, then an NSAutoreleasePool release. This is good for a ~30% speed increase.
-static void rkl_CFCallbackRelease(CFAllocatorRef allocator RKL_UNUSED_ARG, const void *ptr) { CFRelease((CFTypeRef)ptr); }
+static void rkl_CFCallbackRelease(CFAllocatorRef allocator RKL_UNUSED_ARG, const void *ptr) { /*CFRelease((CFTypeRef)ptr); */ }
static const CFArrayCallBacks rkl_transferOwnershipArrayCallBacks = { (CFIndex)0L, NULL, rkl_CFCallbackRelease, CFCopyDescription, CFEqual };
static const CFDictionaryKeyCallBacks rkl_transferOwnershipDictionaryKeyCallBacks = { (CFIndex)0L, NULL, rkl_CFCallbackRelease, CFCopyDescription, CFEqual, CFHash };
static const CFDictionaryValueCallBacks rkl_transferOwnershipDictionaryValueCallBacks = { (CFIndex)0L, NULL, rkl_CFCallbackRelease, CFCopyDescription, CFEqual };
Please sign in to comment.
Something went wrong with that request. Please try again.