mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-02-23 11:41:05 +00:00
Code to mitigate issues with loadable bundles.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@20749 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
2688176533
commit
6a418628a1
3 changed files with 59 additions and 24 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2005-02-19 02:29 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Defaults.plist: Added new default "AllowUserBundles" to
|
||||
disable new code which prevents Gorm from running if a
|
||||
user bundle is present.
|
||||
* Gorm.m: Added code in [Gorm applicationDidFinishLaunching:]
|
||||
to warn the user and quit, unless the above default is set,
|
||||
if there is a user bundle loaded. It will give the user
|
||||
a few panels explaining what's going on.
|
||||
|
||||
2005-02-15 23:37 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* GormPosingView.[hm]: Removed.
|
||||
|
|
|
@ -1,22 +1,25 @@
|
|||
{
|
||||
PreloadHeaders = NO;
|
||||
ShowPalettes = YES;
|
||||
ShowInspectors = YES;
|
||||
HeaderList = ();
|
||||
CellSizeWidth = 72;
|
||||
ArchiveType = Typed;
|
||||
GuideColor = {
|
||||
alpha = 1;
|
||||
blue = 0;
|
||||
green = 0;
|
||||
red = 1;
|
||||
};
|
||||
BuiltinPalettes = (
|
||||
"0Menus.palette",
|
||||
"1Windows.palette",
|
||||
"2Controls.palette",
|
||||
"3Containers.palette",
|
||||
"4Data.palette"
|
||||
);
|
||||
UserPalettes = ();
|
||||
}
|
||||
AllowUserBundles = NO;
|
||||
ArchiveType = Typed;
|
||||
BuiltinPalettes = (
|
||||
0Menus.palette,
|
||||
1Windows.palette,
|
||||
2Controls.palette,
|
||||
3Containers.palette,
|
||||
4Data.palette
|
||||
);
|
||||
CellSizeWidth = 72;
|
||||
GuideColor = {
|
||||
alpha = 1;
|
||||
blue = 0;
|
||||
green = 0;
|
||||
red = 1;
|
||||
};
|
||||
HeaderList = (
|
||||
);
|
||||
PreloadHeaders = NO;
|
||||
ShowInspectors = YES;
|
||||
ShowPalettes = YES;
|
||||
UserPalettes = (
|
||||
);
|
||||
}
|
28
Gorm.m
28
Gorm.m
|
@ -44,6 +44,9 @@ NSString *GormResizeCellNotification = @"GormResizeCellNotification";
|
|||
// Define this as "NO" initially. We only want to turn this on while loading or testing.
|
||||
static BOOL _isInInterfaceBuilder = NO;
|
||||
|
||||
// Has poseAs: been called?
|
||||
static BOOL _illegalClassSubstitution = NO;
|
||||
|
||||
static NSImage *gormImage = nil;
|
||||
static NSImage *testingImage = nil;
|
||||
|
||||
|
@ -107,8 +110,14 @@ static NSImage *testingImage = nil;
|
|||
@implementation NSObject (GormPrivate)
|
||||
+ (void) poseAsClass: (Class)aClassObject
|
||||
{
|
||||
BOOL allow = [[NSUserDefaults standardUserDefaults] boolForKey: @"AllowUserBundles"];
|
||||
|
||||
// disable poseAs: while in Gorm.
|
||||
// class_pose_as(self, aClassObject);
|
||||
class_pose_as(self, aClassObject);
|
||||
if(!allow)
|
||||
{
|
||||
_illegalClassSubstitution = YES;
|
||||
}
|
||||
}
|
||||
@end
|
||||
|
||||
|
@ -331,12 +340,25 @@ static NSImage *testingImage = nil;
|
|||
{
|
||||
[[[self palettesManager] panel] makeKeyAndOrderFront: self];
|
||||
}
|
||||
if((a = [defaults arrayForKey: @"GSAppKitUserBundles"]) != nil)
|
||||
if((a = [defaults arrayForKey: @"GSAppKitUserBundles"]) != nil ||
|
||||
_illegalClassSubstitution == YES)
|
||||
{
|
||||
if([a count] > 0)
|
||||
{
|
||||
NSLog(@"WARNING: Gorm has detected that you are using user bundles. Please make certain that these are compatible with Gorm as some bundles can cause issues which may corrupt your .gorm files.");
|
||||
NSRunAlertPanel(_(@"User Bundle Warning"),
|
||||
_(@"Gorm has detected that you are using user bundles. Please make certain that these are compatible with Gorm as some bundles can cause issues which may corrupt your .gorm files."),
|
||||
_(@"OK"), nil, nil);
|
||||
}
|
||||
|
||||
if(_illegalClassSubstitution == YES)
|
||||
{
|
||||
NSRunAlertPanel(_(@"Illegal Class Substitution"),
|
||||
_(@"A bundle has invoked 'poseAsClass:', this could corrupt .gorm files. Quitting."),
|
||||
_(@"OK"), nil, nil);
|
||||
NSBeep();
|
||||
[self terminate: self];
|
||||
}
|
||||
|
||||
}
|
||||
if(GSGetMethod([GSNibContainer class],@selector(awakeWithContext:),YES,YES) == NULL)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue