From d0ab85ac95e7e38c38a215d83ee12a22d7de3099 Mon Sep 17 00:00:00 2001 From: Gregory John Casamento Date: Sat, 30 Jul 2005 19:53:09 +0000 Subject: [PATCH] Corrected crash when changing class hierarchy. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@21576 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 11 +++ .../GormPreferences.gorm/data.classes | 5 +- English.lproj/GormPreferences.gorm/data.info | Bin 184 -> 184 bytes .../GormPreferences.gorm/objects.gorm | Bin 11804 -> 11821 bytes Gorm.m | 6 +- GormCore/GormClassInspector.m | 12 ++- GormCore/GormPrivate.m | 3 +- GormPrefs/GormPrefController.h | 8 +- GormPrefs/GormPrefController.m | 78 +++++++++++------- 9 files changed, 84 insertions(+), 39 deletions(-) diff --git a/ChangeLog b/ChangeLog index dbf0e6fa..20e812cd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2005-07-30 15:57 Gregory John Casamento + + * English.lproj/GormPreferences.gorm: Changed class hierarchy. Also + added panel outlet. + * GormCore/GormClassInspector.m: -[GormClassInspector _currentClass] + copy the className. + * GormCore/GormPrivate.m: -[GormClassProxy init] copy the className. + * Gorm.m: Changed to initialize preferences panel using init. + * GormPrefs/GormPrefController.[hm]: Added panel method, changed + derivation to a subclass of NSObject, instead of NSWindowController. + 2005-07-30 09:30 Gregory John Casamento * Documentation/Makefile.postamble: Generate documentation from diff --git a/English.lproj/GormPreferences.gorm/data.classes b/English.lproj/GormPreferences.gorm/data.classes index ebee891d..2b6c7f7a 100644 --- a/English.lproj/GormPreferences.gorm/data.classes +++ b/English.lproj/GormPreferences.gorm/data.classes @@ -6,8 +6,9 @@ ); Outlets = ( popup, - prefBox + prefBox, + panel ); - Super = NSWindowController; + Super = NSObject; }; } \ No newline at end of file diff --git a/English.lproj/GormPreferences.gorm/data.info b/English.lproj/GormPreferences.gorm/data.info index 35701e5f84117b984d5c514f993bc215a6222413..deffaf260e59bbf2baa9d29d878df14631ddaac2 100644 GIT binary patch delta 13 UcmdnNxPx(m2y>EY@t<8 delta 13 UcmdnNxPx(m2yaeh-i{&vXucC7$rg&hQ=lvHAMv&Jto@=h%tI>4imV|B;mrqASTAm00dw{ zjN3UM$aHeq>?z#HD3OjKI}a%9oWA*yNWTEv2_V~L+U9cAT;|CZ3NN(~n zZC%EnldovEXaATmA%Ib4qw0pIAcicE@dU(>12Ue081g{II}k$w$XEelC~j1}z{mh% zDS=pwAeOSB8iR;muwQ19e`!fhYKe1xUS4W)Nq!N?O$-}0Z1@qts4{thuH9r&U4?oe zM-AdQc95f4L2hDa@(cDa&r2-|U{v2I0CG4FNRA66$HT%p8br9kY+kjzlRkO}1H zF<1pKYHU=yz^Jxib^xO$L>t&hur_v(wjzd9hBO8zpz?|UMlG;nUyy6GA*xy7marmO g62PbfF?K@$qb|gyXbKa7wx=@W1TgANzOQQw0OBKoF#rGn delta 525 zcmZ1*Gbd((h-hM(rIi5~7$rg&hQ_8FHAMv&eJ0xrh%x$X4imV|B<#V!ASTAm00dw{ zjN3VXa-e|t=4j!3Mu`jz$$3C^&Ka8@iS!GwEda7z8a9`!<}y!i(~@L1HuyPNUDHkY z*G4Wikb$Zo!r=Et9)mxV8#G(F|88Uji%&54H(5YSn#th*bfs7R(h8B?V0cZ-4sl8G40wV)RPzS_f q1hI5Cs%_Y?0q6|9jRK%R6$RPB1@f>c3q$7QTRK{d`jbEC+5!Ma7l`5j diff --git a/Gorm.m b/Gorm.m index 28a6943f..f1b38c61 100644 --- a/Gorm.m +++ b/Gorm.m @@ -35,7 +35,7 @@ @interface Gorm : NSApplication { id infoPanel; - id preferencesController; + GormPrefController *preferencesController; GormClassManager *classManager; GormInspectorsManager *inspectorsManager; GormPalettesManager *palettesManager; @@ -425,10 +425,10 @@ { if(! preferencesController) { - preferencesController = [[GormPrefController alloc] initWithWindowNibName:@"GormPreferences"]; + preferencesController = [[GormPrefController alloc] init]; } - [[preferencesController window] makeKeyAndOrderFront:nil]; + [[preferencesController panel] makeKeyAndOrderFront:nil]; } /** Document Menu Actions */ diff --git a/GormCore/GormClassInspector.m b/GormCore/GormClassInspector.m index 64f2b3ae..5d5b14f0 100644 --- a/GormCore/GormClassInspector.m +++ b/GormCore/GormClassInspector.m @@ -657,7 +657,17 @@ objectValueForTableColumn: (NSTableColumn *)tc - (NSString *) _currentClass { - return [object className]; + if(object == nil) + { + return nil; + } + + if([object className] == nil) + { + return nil; + } + + return [NSString stringWithString: [object className]]; } - (void) handleNotification: (NSNotification *)notification diff --git a/GormCore/GormPrivate.m b/GormCore/GormPrivate.m index bd43ec71..e3990ad7 100644 --- a/GormCore/GormPrivate.m +++ b/GormCore/GormPrivate.m @@ -186,7 +186,8 @@ static BOOL _isInInterfaceBuilder = NO; { if([n isKindOfClass: [NSString class]]) { - ASSIGN(name, n); + // create a copy. + name = [[NSString alloc] initWithString: n]; } else { diff --git a/GormPrefs/GormPrefController.h b/GormPrefs/GormPrefController.h index 498922e5..0cf49865 100644 --- a/GormPrefs/GormPrefController.h +++ b/GormPrefs/GormPrefController.h @@ -29,9 +29,9 @@ #include #include -@interface GormPrefController : NSWindowController +@interface GormPrefController : NSObject { - id window; + id panel; id popup; id prefBox; @@ -48,6 +48,10 @@ */ - (void) popupAction: (id)sender; +/** + * Return the preferences panel. + */ +- (id) panel; @end #endif diff --git a/GormPrefs/GormPrefController.m b/GormPrefs/GormPrefController.m index 2ac39a6e..ebe39e39 100644 --- a/GormPrefs/GormPrefController.m +++ b/GormPrefs/GormPrefController.m @@ -13,6 +13,18 @@ @implementation GormPrefController +- (id) init +{ + if(self = [super init]) + { + if(![NSBundle loadNibNamed: @"GormPreferences" owner: self]) + { + return nil; + } + } + return self; +} + - (void) awakeFromNib { _generalView = [[GormGeneralPref alloc] init]; @@ -24,43 +36,43 @@ [prefBox setContentView:[_generalView view]]; - [[self window] setFrameUsingName: @"Preferences"]; - [[self window] setFrameAutosaveName: @"Preferences"]; - [[self window] center]; + [[self panel] setFrameUsingName: @"Preferences"]; + [[self panel] setFrameAutosaveName: @"Preferences"]; + [[self panel] center]; } - (void) popupAction: (id)sender { + int tag = -1; + if ( sender != popup ) return; - { - int tag = [[sender selectedItem] tag]; - switch(tag) - { - case 0: - [prefBox setContentView: [_generalView view]]; - break; - case 1: - [prefBox setContentView: [_headersView view]]; - break; - case 2: - [prefBox setContentView: [_shelfView view]]; - break; - case 3: - [prefBox setContentView: [_colorsView view]]; - break; - case 4: - [prefBox setContentView: [_palettesView view]]; - break; - case 5: - [prefBox setContentView: [_guidelineView view]]; - break; - default: - NSLog(@"Error Default (GormPrefController.m) : - (void) popupAction: (id)sender, no match for tag %d",tag); - break; - } - } + tag = [[sender selectedItem] tag]; + switch(tag) + { + case 0: + [prefBox setContentView: [_generalView view]]; + break; + case 1: + [prefBox setContentView: [_headersView view]]; + break; + case 2: + [prefBox setContentView: [_shelfView view]]; + break; + case 3: + [prefBox setContentView: [_colorsView view]]; + break; + case 4: + [prefBox setContentView: [_palettesView view]]; + break; + case 5: + [prefBox setContentView: [_guidelineView view]]; + break; + default: + NSLog(@"Error Default (GormPrefController.m) : - (void) popupAction: (id)sender, no match for tag %d",tag); + break; + } } - (void) dealloc @@ -70,6 +82,12 @@ RELEASE(_shelfView); RELEASE(_colorsView); RELEASE(_palettesView); + RELEASE(panel); [super dealloc]; } + +- (id) panel +{ + return panel; +} @end