Change the __NEXT_RUNTIME__ test to __OBJC_GC__ which is what I really meant
but I had to look up which preprocessor define was emitted by -fobjc-gc. Also improve the comments a bit. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@51590 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -15,7 +15,7 @@
|
|||||||
// Reuse wxCFRef-related code (e.g. wxCFRetain/wxCFRelease)
|
// Reuse wxCFRef-related code (e.g. wxCFRetain/wxCFRelease)
|
||||||
#include "wx/mac/corefoundation/cfref.h"
|
#include "wx/mac/corefoundation/cfref.h"
|
||||||
|
|
||||||
// NOTE WELL: We can only know which Objective-C runtime is being used when compiling Objective-C.
|
// NOTE WELL: We can only know whether or not GC can be used when compiling Objective-C.
|
||||||
// Therefore we cannot implement these functions except when compiling Objective-C.
|
// Therefore we cannot implement these functions except when compiling Objective-C.
|
||||||
#ifdef __OBJC__
|
#ifdef __OBJC__
|
||||||
/*! @function wxGCSafeRetain
|
/*! @function wxGCSafeRetain
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
template <class Type>
|
template <class Type>
|
||||||
inline Type * wxGCSafeRetain(Type *r)
|
inline Type * wxGCSafeRetain(Type *r)
|
||||||
{
|
{
|
||||||
#ifdef __NEXT_RUNTIME__
|
#ifdef __OBJC_GC__
|
||||||
return static_cast<Type*>(wxCFRetain(r));
|
return static_cast<Type*>(wxCFRetain(r));
|
||||||
#else
|
#else
|
||||||
return [r retain];
|
return [r retain];
|
||||||
@@ -90,7 +90,7 @@ inline Type * wxGCSafeRetain(Type *r)
|
|||||||
template <class Type>
|
template <class Type>
|
||||||
inline void wxGCSafeRelease(Type *r)
|
inline void wxGCSafeRelease(Type *r)
|
||||||
{
|
{
|
||||||
#ifdef __NEXT_RUNTIME__
|
#ifdef __OBJC_GC__
|
||||||
wxCFRelease(r);
|
wxCFRelease(r);
|
||||||
#else
|
#else
|
||||||
[r release];
|
[r release];
|
||||||
@@ -99,7 +99,10 @@ inline void wxGCSafeRelease(Type *r)
|
|||||||
#else
|
#else
|
||||||
// NOTE: When not compiling Objective-C, declare these functions such that they can be
|
// NOTE: When not compiling Objective-C, declare these functions such that they can be
|
||||||
// used by other inline-implemented methods. Since those methods in turn will not actually
|
// used by other inline-implemented methods. Since those methods in turn will not actually
|
||||||
// be used from non-ObjC code there is no problem.
|
// be used from non-ObjC code the compiler ought not to emit them. If it emits an out
|
||||||
|
// of line copy of functions using these functions then presumably it will have also emitted
|
||||||
|
// in at least one source file an out of line copy of these functions and there will be
|
||||||
|
// no problem at link time.
|
||||||
|
|
||||||
template <class Type>
|
template <class Type>
|
||||||
inline Type * wxGCSafeRetain(Type *r);
|
inline Type * wxGCSafeRetain(Type *r);
|
||||||
|
Reference in New Issue
Block a user