mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 16:30:41 +00:00
2002-10-25 Mirko Viviani <mirko.viviani@rccr.cremona.it>
* Source/NSBundle.m ([NSBundle -load]): set _codeLoaded before loading the bundle. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@14839 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
cff8d711c9
commit
bca5e26929
2 changed files with 24 additions and 4 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2002-10-25 Mirko Viviani <mirko.viviani@rccr.cremona.it>
|
||||||
|
|
||||||
|
* Source/NSBundle.m ([NSBundle -load]): set _codeLoaded before loading
|
||||||
|
the bundle.
|
||||||
|
|
||||||
2002-10-22 Richard Frith-Macdonald <rfm@gnu.org>
|
2002-10-22 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Tools/AGSParser.m: Avoid duplication of method comments when
|
* Tools/AGSParser.m: Avoid duplication of method comments when
|
||||||
|
|
|
@ -338,7 +338,7 @@ _bundle_name_first_match(NSString* directory, NSString* name)
|
||||||
|
|
||||||
/* Try creating the bundle. */
|
/* Try creating the bundle. */
|
||||||
bundle = [[self alloc] initWithPath: bundlePath];
|
bundle = [[self alloc] initWithPath: bundlePath];
|
||||||
|
|
||||||
if (bundle == nil)
|
if (bundle == nil)
|
||||||
{
|
{
|
||||||
/* TODO: We couldn't locate the framework in the expected
|
/* TODO: We couldn't locate the framework in the expected
|
||||||
|
@ -385,6 +385,15 @@ _bundle_name_first_match(NSString* directory, NSString* name)
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
/*
|
||||||
|
Mirko:
|
||||||
|
|
||||||
|
The gnu-runtime calls the +load method of each class before the
|
||||||
|
_bundle_load_callback() is called and we can't provide the list of classes
|
||||||
|
ready for this method.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
_bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
_bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
||||||
{
|
{
|
||||||
|
@ -900,13 +909,13 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
||||||
|
|
||||||
- (BOOL) load
|
- (BOOL) load
|
||||||
{
|
{
|
||||||
if (self == _mainBundle || self == _gnustep_bundle)
|
if (self == _mainBundle || self == _gnustep_bundle)
|
||||||
{
|
{
|
||||||
_codeLoaded = YES;
|
_codeLoaded = YES;
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
[load_lock lock];
|
[load_lock lock];
|
||||||
|
|
||||||
if (!_codeLoaded)
|
if (!_codeLoaded)
|
||||||
{
|
{
|
||||||
NSString *object, *path;
|
NSString *object, *path;
|
||||||
|
@ -937,15 +946,21 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
||||||
_loadingBundle = self;
|
_loadingBundle = self;
|
||||||
_bundleClasses = RETAIN([NSMutableArray arrayWithCapacity: 2]);
|
_bundleClasses = RETAIN([NSMutableArray arrayWithCapacity: 2]);
|
||||||
_loadingFrameworks = RETAIN([NSMutableArray arrayWithCapacity: 2]);
|
_loadingFrameworks = RETAIN([NSMutableArray arrayWithCapacity: 2]);
|
||||||
|
|
||||||
|
/* This code is executed twice if a class linked in the bundle call a
|
||||||
|
NSBundle method inside +load (-principalClass). To avoid this we set
|
||||||
|
_codeLoaded before loading the bundle. */
|
||||||
|
_codeLoaded = YES;
|
||||||
|
|
||||||
if (objc_load_module([object fileSystemRepresentation],
|
if (objc_load_module([object fileSystemRepresentation],
|
||||||
stderr, _bundle_load_callback, NULL, NULL))
|
stderr, _bundle_load_callback, NULL, NULL))
|
||||||
{
|
{
|
||||||
|
_codeLoaded = NO;
|
||||||
DESTROY(_loadingFrameworks);
|
DESTROY(_loadingFrameworks);
|
||||||
DESTROY(_currentFrameworkName);
|
DESTROY(_currentFrameworkName);
|
||||||
[load_lock unlock];
|
[load_lock unlock];
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
_codeLoaded = YES;
|
|
||||||
|
|
||||||
/* We now construct the list of bundles from frameworks linked with
|
/* We now construct the list of bundles from frameworks linked with
|
||||||
this one */
|
this one */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue