summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordas <das>2009-10-05 02:41:17 (GMT)
committerdas <das>2009-10-05 02:41:17 (GMT)
commitf9dae4a940acc35572f2aea0f6b04646a51d802a (patch)
treeb2f5104231b12599417be705d443a4b804cb7866
parent26547a1397053787d658743264d1d47d19d3c076 (diff)
downloadtcl-f9dae4a940acc35572f2aea0f6b04646a51d802a.zip
tcl-f9dae4a940acc35572f2aea0f6b04646a51d802a.tar.gz
tcl-f9dae4a940acc35572f2aea0f6b04646a51d802a.tar.bz2
* macosx/tclMacOSXBundle.c: Workaround CF memory managment bug in
* unix/tclUnixInit.c: Mac OS X 10.4 & earlier. [Bug 2569449]
-rw-r--r--ChangeLog5
-rw-r--r--macosx/tclMacOSXBundle.c33
-rw-r--r--unix/tclUnixInit.c11
3 files changed, 33 insertions, 16 deletions
diff --git a/ChangeLog b/ChangeLog
index 7bd1f8e..a1a2ef0 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-09-28 Don Porter <dgp@users.sourceforge.net>
* generic/tclAlloc.c: Cleaned up various routines in the
diff --git a/macosx/tclMacOSXBundle.c b/macosx/tclMacOSXBundle.c
index af047d2..ef87dbf 100644
--- a/macosx/tclMacOSXBundle.c
+++ b/macosx/tclMacOSXBundle.c
@@ -5,7 +5,7 @@
* MacOS X.
*
* Copyright 2001, Apple Computer, Inc.
- * Copyright (c) 2003-2007 Daniel A. Steffen <das@users.sourceforge.net>
+ * Copyright (c) 2003-2009 Daniel A. Steffen <das@users.sourceforge.net>
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -48,7 +48,7 @@
* permission to use and distribute the software in accordance with the
* terms specified in this license.
*
- * RCS: @(#) $Id: tclMacOSXBundle.c,v 1.3.2.7 2008/12/07 16:39:56 das Exp $
+ * RCS: @(#) $Id: tclMacOSXBundle.c,v 1.3.2.8 2009/10/05 02:41:18 das Exp $
*/
#include "tclPort.h"
@@ -56,6 +56,11 @@
#ifdef HAVE_COREFOUNDATION
#include <CoreFoundation/CoreFoundation.h>
#include <mach-o/dyld.h>
+
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 1050
+MODULE_SCOPE long tclMacOSXDarwinRelease;
+#endif
+
#endif /* HAVE_COREFOUNDATION */
/*
@@ -145,17 +150,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);
@@ -163,9 +167,13 @@ Tcl_MacOSXOpenVersionedBundleResources(
CFURLRef versionedBundleURL =
CFURLCreateCopyAppendingPathComponent(
NULL, versURL, bundleVersionRef, TRUE);
+
if (versionedBundleURL) {
versionedBundleRef = CFBundleCreate(NULL,
versionedBundleURL);
+ if (versionedBundleRef) {
+ bundleRef = versionedBundleRef;
+ }
CFRelease(versionedBundleURL);
}
CFRelease(versURL);
@@ -175,9 +183,6 @@ Tcl_MacOSXOpenVersionedBundleResources(
}
CFRelease(bundleURL);
}
- if (versionedBundleRef) {
- bundleRef = versionedBundleRef;
- }
}
if (bundleRef) {
@@ -225,7 +230,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 795d312..f2918d7 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.34.2.15 2007/04/29 02:19:51 das Exp $
+ * RCS: @(#) $Id: tclUnixInit.c,v 1.34.2.16 2009/10/05 02:41:18 das Exp $
*/
#if defined(HAVE_COREFOUNDATION)
@@ -159,10 +159,11 @@ static int MacOSXGetLibraryPath _ANSI_ARGS_((
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().