From 70179f6bd5bd48ccd1c1ef1e16cb986f2e12bee9 Mon Sep 17 00:00:00 2001 From: CaS Date: Thu, 26 Apr 2001 16:19:12 +0000 Subject: [PATCH] Nasty recursion problem fixed. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@9714 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 9 +++++++++ Source/NSString.m | 9 ++++++++- Source/externs.m | 6 ++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 71fd236e3..07d2ca396 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2001-04-26 Richard Frith-Macdonald + + * Source/NSString.m: ([+initialize]) protect with flag so it is safe + to call this method more than once. + * Source/externs.m: GSBuildStrings() call +initialize method for + NSString to ensure that the class is properly initialised even if + this function has been called from NSObjects +initialize, which was + in turn called in preparation for NSString initialisation! + 2001-04-25 Adam Fedor * configure.in: Much simplified NeXT checks. Just use LIBRARY_COMBO diff --git a/Source/NSString.m b/Source/NSString.m index 9f8c25546..afe2900a3 100644 --- a/Source/NSString.m +++ b/Source/NSString.m @@ -307,8 +307,15 @@ handle_printf_atsign (FILE *stream, + (void) initialize { - if (self == [NSString class]) + /* + * Flag required as we call this method explicitly from GSBuildStrings() + * to ensure that NSString is initialised properly. + */ + static BOOL beenHere = NO; + + if (self == [NSString class] && beenHere == NO) { + beenHere = YES; plSel = @selector(initWithCharacters:length:); cMemberSel = @selector(characterIsMember:); _DefaultStringEncoding = GetDefEncoding(); diff --git a/Source/externs.m b/Source/externs.m index d573e3a67..10a6f4b9d 100644 --- a/Source/externs.m +++ b/Source/externs.m @@ -308,6 +308,12 @@ GSBuildStrings() if (SClass == 0) { SClass = [NSString class]; + /* + * Ensure that NSString is initialized ... because we are called + * from [NSObject +initialize] which might be executing as a + * result of a call to [NSString +initialize] ! + */ + [SClass initialize]; InPortAcceptedClientNotification = [[SClass alloc] initWithCString: "InPortAcceptedClientNotification"];