summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--macosx/tclMacOSXBundle.c29
-rw-r--r--unix/tclUnixInit.c11
3 files changed, 29 insertions, 16 deletions
diff --git a/ChangeLog b/ChangeLog
index a514a58..3da653d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-10-04 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tclMacOSXBundle.c: Workaround CF memory managment bug in
+ * unix/tclUnixInit.c: Mac OS X 10.4 & earlier. [Bug 2569449]
+
2009-10-02 Kevin B. Kenny <kennykb@acm.org>
* library/tzdata/Africa/Cairo:
diff --git a/macosx/tclMacOSXBundle.c b/macosx/tclMacOSXBundle.c
index 69ffd2f..97124cf 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.15 2009/04/14 00:55:31 das Exp $
+ * RCS: @(#) $Id: tclMacOSXBundle.c,v 1.16 2009/10/05 02:41:07 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);
+ }
}
}
diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c
index 2df4d2a..db7bbfe 100644
--- a/unix/tclUnixInit.c
+++ b/unix/tclUnixInit.c
@@ -7,7 +7,7 @@
* Copyright (c) 1999 by Scriptics Corporation.
* All rights reserved.
*
- * RCS: @(#) $Id: tclUnixInit.c,v 1.86 2009/01/09 11:21:46 dkf Exp $
+ * RCS: @(#) $Id: tclUnixInit.c,v 1.87 2009/10/05 02:41:07 das Exp $
*/
#include "tclInt.h"
@@ -274,10 +274,11 @@ static int MacOSXGetLibraryPath(Tcl_Interp *interp,
int maxPathLen, char *tclLibPath);
#endif /* HAVE_COREFOUNDATION */
#if defined(__APPLE__) && (defined(TCL_LOAD_FROM_MEMORY) || ( \
- defined(TCL_THREADS) && defined(MAC_OS_X_VERSION_MIN_REQUIRED) && \
- MAC_OS_X_VERSION_MIN_REQUIRED < 1030) || ( \
- defined(__LP64__) && defined(MAC_OS_X_VERSION_MIN_REQUIRED) && \
- MAC_OS_X_VERSION_MIN_REQUIRED < 1050))
+ defined(MAC_OS_X_VERSION_MIN_REQUIRED) && ( \
+ (defined(TCL_THREADS) && MAC_OS_X_VERSION_MIN_REQUIRED < 1030) || \
+ (defined(__LP64__) && MAC_OS_X_VERSION_MIN_REQUIRED < 1050) || \
+ (defined(HAVE_COREFOUNDATION) && MAC_OS_X_VERSION_MIN_REQUIRED < 1050)\
+ )))
/*
* Need to check Darwin release at runtime in tclUnixFCmd.c and tclLoadDyld.c:
* initialize release global at startup from uname().