bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #32378] Exception when starting ANY application....


From: Gregory John Casamento
Subject: [bug #32378] Exception when starting ANY application....
Date: Mon, 07 Feb 2011 07:08:31 +0000
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.0.249.43 Safari/532.5

Follow-up Comment #1, bug #32378 (project gnustep):

+ (id) currentLocale
{
  NSLocale *result;

  [classLock lock];
  if (nil == currentLocale)
    {
      NSString *localeId;
      [classLock unlock];
      
      localeId =
        [[NSUserDefaults standardUserDefaults] objectForKey: @"Locale"];
      
      [classLock lock];
      if (currentLocale == nil)
        currentLocale = [[NSLocale alloc] initWithLocaleIdentifier:
localeId];
    }
  result = RETAIN(currentLocale);
  [classLock unlock];
  return AUTORELEASE(result);
}

If "Locale" in my user defaults is nil, then it seems like it's pretty much
doomed to failure, since...

- (id) initWithLocaleIdentifier: (NSString*)string
{
  NSLocale      *newLocale;
  NSString      *localeId;
#if     GS_USE_ICU == 1
  int32_t       length;
  char cLocaleId[ULOC_FULLNAME_CAPACITY];
  UErrorCode error = U_ZERO_ERROR;
  
  localeId = [NSLocale canonicalLocaleIdentifierFromString: string];
  // Normalize locale ID
  length = uloc_canonicalize ([localeId UTF8String], cLocaleId,
    ULOC_FULLNAME_CAPACITY, &error);
  if (U_FAILURE(error))
    {
      [self release];
      return nil;
    }
  
  localeId = [NSString stringWithUTF8String: cLocaleId];
#else
  localeId = [NSLocale canonicalLocaleIdentifierFromString: string];
#endif

  [classLock lock];
  newLocale = [allLocales objectForKey: localeId];
  if (nil == newLocale)
    {
      _localeId = [localeId copy];
      [allLocales setObject: self forKey: localeId];
    }
  else
    {
      [self release];
      self = [newLocale retain];
    }
  [classLock unlock];
  
  _components = [[NSMutableDictionary alloc] initWithCapacity: 0];

  return self;
}

It's passing nil into the init function here and then getting the
canonicalized locale identifier from the nil value which was passed in... it
then attempts get newLocale based on the "canonicalized" nil value which, of
course is also nil.... and the proceeds to set that nil object into allLocales
which throws the exception.

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?32378>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]