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 fb7ef95..8980aca 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 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);
+ }
}
}
diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c
index a9309c3..d11c8c5 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.82 2007/12/13 15:28:42 dgp Exp $
+ * RCS: @(#) $Id: tclUnixInit.c,v 1.82.2.1 2009/10/05 02:41:13 das Exp $
*/
#include "tclInt.h"
@@ -335,10 +335,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().