diff options
author | das <das> | 2009-10-05 02:41:12 (GMT) |
---|---|---|
committer | das <das> | 2009-10-05 02:41:12 (GMT) |
commit | baf0bbcdc4154c963a7f352c2349ce190b02d90d (patch) | |
tree | 15855a50a2f1534426ea9a1833ae76d1e15610d3 /macosx/tclMacOSXBundle.c | |
parent | 676ad5463f70db98f8ae3e63ace7bba8ecccbd54 (diff) | |
download | tcl-baf0bbcdc4154c963a7f352c2349ce190b02d90d.zip tcl-baf0bbcdc4154c963a7f352c2349ce190b02d90d.tar.gz tcl-baf0bbcdc4154c963a7f352c2349ce190b02d90d.tar.bz2 |
* macosx/tclMacOSXBundle.c: Workaround CF memory managment bug in
* unix/tclUnixInit.c: Mac OS X 10.4 & earlier. [Bug 2569449]
Diffstat (limited to 'macosx/tclMacOSXBundle.c')
-rw-r--r-- | macosx/tclMacOSXBundle.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/macosx/tclMacOSXBundle.c b/macosx/tclMacOSXBundle.c index 776fb6b..bf1d651 100644 --- a/macosx/tclMacOSXBundle.c +++ b/macosx/tclMacOSXBundle.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclMacOSXBundle.c,v 1.11.4.3 2009/04/14 00:55:34 das Exp $ + * RCS: @(#) $Id: tclMacOSXBundle.c,v 1.11.4.4 2009/10/05 02:41:13 das Exp $ */ #include "tclPort.h" @@ -55,7 +55,8 @@ extern char *dlerror(void) WEAK_IMPORT_ATTRIBUTE; #include <mach-o/dyld.h> #endif -#if TCL_DYLD_USE_DLFCN && MAC_OS_X_VERSION_MIN_REQUIRED < 1040 +#if (TCL_DYLD_USE_DLFCN && MAC_OS_X_VERSION_MIN_REQUIRED < 1040) || \ + (MAC_OS_X_VERSION_MIN_REQUIRED < 1050) MODULE_SCOPE long tclMacOSXDarwinRelease; #endif @@ -157,17 +158,16 @@ Tcl_MacOSXOpenVersionedBundleResources( bundleVersion, kCFStringEncodingUTF8); if (bundleVersionRef) { + CFComparisonResult versionComparison = kCFCompareLessThan; CFStringRef bundleTailRef = CFURLCopyLastPathComponent( bundleURL); if (bundleTailRef) { - if (CFStringCompare(bundleTailRef, bundleVersionRef, 0) == - kCFCompareEqualTo) { - versionedBundleRef = (CFBundleRef) CFRetain(bundleRef); - } + versionComparison = CFStringCompare(bundleTailRef, + bundleVersionRef, 0); CFRelease(bundleTailRef); } - if (!versionedBundleRef) { + if (versionComparison != kCFCompareEqualTo) { CFURLRef versURL = CFURLCreateCopyAppendingPathComponent( NULL, bundleURL, CFSTR("Versions"), TRUE); @@ -175,9 +175,13 @@ Tcl_MacOSXOpenVersionedBundleResources( CFURLRef versionedBundleURL = CFURLCreateCopyAppendingPathComponent( NULL, versURL, bundleVersionRef, TRUE); + if (versionedBundleURL) { versionedBundleRef = CFBundleCreate(NULL, versionedBundleURL); + if (versionedBundleRef) { + bundleRef = versionedBundleRef; + } CFRelease(versionedBundleURL); } CFRelease(versURL); @@ -187,9 +191,6 @@ Tcl_MacOSXOpenVersionedBundleResources( } CFRelease(bundleURL); } - if (versionedBundleRef) { - bundleRef = versionedBundleRef; - } } if (bundleRef) { @@ -258,7 +259,13 @@ Tcl_MacOSXOpenVersionedBundleResources( CFRelease(libURL); } if (versionedBundleRef) { - CFRelease(versionedBundleRef); +#if MAC_OS_X_VERSION_MIN_REQUIRED < 1050 + /* Workaround CFBundle bug in Tiger and earlier. [Bug 2569449] */ + if (tclMacOSXDarwinRelease >= 9) +#endif + { + CFRelease(versionedBundleRef); + } } } |