diff --git a/ChangeLog b/ChangeLog index c7ec6baa2..e3adc908a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2009-10-17 Sheldon Gill + + * Source/NSApplication.m: centralise GSGuiBundle() routine + 2009-10-16 Sheldon Gill * Source/NSEvent.m: add default for unknown events diff --git a/Source/NSApplication.m b/Source/NSApplication.m index 0b6f61709..55ffc86a9 100644 --- a/Source/NSApplication.m +++ b/Source/NSApplication.m @@ -152,13 +152,20 @@ _NSAppKitUncaughtExceptionHandler (NSException *exception) } } -/* This is the bundle from where we load localization of messages. */ -static NSBundle *guiBundle = nil; - /* Get the bundle. */ NSBundle * GSGuiBundle(void) { + /* This is the bundle from where we load localization of messages. */ + static NSBundle *guiBundle = nil; + + if (!guiBundle) + { + /* Create the gui bundle we use to localize messages. */ + guiBundle = [NSBundle bundleForLibrary: @"gnustep-gui" + version: OBJC_STRINGIFY(GNUSTEP_GUI_MAJOR_VERSION.GNUSTEP_GUI_MINOR_VERSION)]; + RETAIN(guiBundle); + } return guiBundle; } @@ -716,12 +723,7 @@ static NSSize scaledIconSizeForSize(NSSize imageSize) GSStringDrawingDummyFunction(); [self setVersion: 1]; - - /* Create the gui bundle we use to localize messages. */ - guiBundle = [NSBundle bundleForLibrary: @"gnustep-gui" - version: OBJC_STRINGIFY(GNUSTEP_GUI_MAJOR_VERSION.GNUSTEP_GUI_MINOR_VERSION)]; - RETAIN(guiBundle); - + /* Cache the NSAutoreleasePool class */ arpClass = [NSAutoreleasePool class]; nc = [NSNotificationCenter defaultCenter];