diff --git a/ChangeLog b/ChangeLog index 3e81850b6..48aec2b71 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,7 @@ * Source/NSDistributedNotificationCenter.m: Partially reverted last change ... seemed to cause problems on some systems. * Tools/gdnc.m: ditto. + * Source/NSDebug.m: Small thread safely fix. 2003-07-23 Richard Frith-Macdonald diff --git a/Source/NSDebug.m b/Source/NSDebug.m index 40d75417b..28d8c3957 100644 --- a/Source/NSDebug.m +++ b/Source/NSDebug.m @@ -28,6 +28,7 @@ #include "config.h" #include +#include "Foundation/NSData.h" #include "Foundation/NSDebug.h" #include "Foundation/NSString.h" #include "Foundation/NSLock.h" @@ -423,7 +424,9 @@ GSDebugAllocationClassList() const char* GSDebugAllocationList(BOOL changeFlag) { - const char *ans; + const char *ans; + NSData *d; + if (debug_allocation == NO) { return "Debug allocation system is not active!\n"; @@ -431,9 +434,10 @@ GSDebugAllocationList(BOOL changeFlag) if (uniqueLock != nil) [uniqueLock lock]; ans = _GSDebugAllocationList(changeFlag); + d = [NSData dataWithBytes: ans length: strlen(ans) + 1]; if (uniqueLock != nil) [uniqueLock unlock]; - return ans; + return (const char*)[d bytes]; } static const char* @@ -520,7 +524,9 @@ _GSDebugAllocationList(BOOL difference) const char* GSDebugAllocationListAll() { - const char *ans; + const char *ans; + NSData *d; + if (debug_allocation == NO) { return "Debug allocation system is not active!\n"; @@ -528,9 +534,10 @@ GSDebugAllocationListAll() if (uniqueLock != nil) [uniqueLock lock]; ans = _GSDebugAllocationListAll(); + d = [NSData dataWithBytes: ans length: strlen(ans)+1]; if (uniqueLock != nil) [uniqueLock unlock]; - return ans; + return (const char*)[d bytes]; } static const char*