Nasty recursion problem fixed.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@9714 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2001-04-26 16:19:12 +00:00
parent 4f6f5da802
commit c4f4f0ea21
3 changed files with 23 additions and 1 deletions

View file

@ -1,3 +1,12 @@
2001-04-26 Richard Frith-Macdonald <rfm@gnu.org>
* 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 <fedor@gnu.org>
* configure.in: Much simplified NeXT checks. Just use LIBRARY_COMBO

View file

@ -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();

View file

@ -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"];