[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fwd: RFC GDL2: move +load implementations to +initialize]
From: |
David Ayers |
Subject: |
[Fwd: RFC GDL2: move +load implementations to +initialize] |
Date: |
Fri, 17 Jan 2003 12:59:39 +0100 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3a) Gecko/20021212 |
Hello again,
when setting up the guile test suit for gdl2 this +load vs. +initialize
bit me. I'm not sure whether there is some special reason why these
implemetations where in +load, but registering for with the
NSNotificationCenter preconditions a lot of set up. In my case even
GSPlaceholderString wasn't setup correctly at the time EODatabaseContext
and EODatabaseChannel got thier +load. (At least in one exectuable, not
in all, and I think this is dependant of linking parameters and thier
order, but I didn't feel like fiddeling with the make system.)
I don't have an app complex enough to test regressions (and the
guile-gdl2 regression testing tool I'm working out now was ironically
the executable bitten) but I believe it to be sane to assume that before
an EODatabaseChannelNeededNotfication is posted, that EODatabseChannel
should have recieved an +initialize and before an
EOCooperatingObjectStoreNeeded is posted, than EODatabaseContext should
have been initialized. If not, then we might in insure all expected
initializes have been sent in some startup function that we somehow
guarantee to be called early in GDL2 initialization.
Here's a patch to move the +load implementations to +initialize.
Cheers,
Dave
? dev-libs/gdl2/Testing
? dev-libs/gdl2/Testing.tar.gz
Index: dev-libs/gdl2/EOAccess/EODatabaseChannel.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/dev-libs/gdl2/EOAccess/EODatabaseChannel.m,v
retrieving revision 1.4
diff -u -r1.4 EODatabaseChannel.m
--- dev-libs/gdl2/EOAccess/EODatabaseChannel.m 31 Dec 2002 16:24:40 -0000
1.4
+++ dev-libs/gdl2/EOAccess/EODatabaseChannel.m 17 Jan 2003 11:50:32 -0000
@@ -68,13 +68,16 @@
@implementation EODatabaseChannel
-+ (void)load
++ (void)initialize
{
- [[NSNotificationCenter defaultCenter]
- addObserver: self
- selector: @selector(_registerDatabaseChannel:)
- name: EODatabaseChannelNeededNotification
- object: nil];
+ if (self == [EODatabaseChannel class])
+ {
+ [[NSNotificationCenter defaultCenter]
+ addObserver: self
+ selector: @selector(_registerDatabaseChannel:)
+ name: EODatabaseChannelNeededNotification
+ object: nil];
+ }
}
+ (void)_registerDatabaseChannel: (NSNotification *)notification
Index: dev-libs/gdl2/EOAccess/EODatabaseContext.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/dev-libs/gdl2/EOAccess/EODatabaseContext.m,v
retrieving revision 1.12
diff -u -r1.12 EODatabaseContext.m
--- dev-libs/gdl2/EOAccess/EODatabaseContext.m 31 Dec 2002 16:24:40 -0000
1.12
+++ dev-libs/gdl2/EOAccess/EODatabaseContext.m 17 Jan 2003 11:50:33 -0000
@@ -104,19 +104,17 @@
static Class _contextClass = Nil;
-+ (void)load
-{
- [[NSNotificationCenter defaultCenter]
- addObserver: self
- selector: @selector(_registerDatabaseContext:)
- name: EOCooperatingObjectStoreNeeded
- object: nil];
-}
-
+ (void)initialize
{
if (!_contextClass)
+ {
_contextClass = [EODatabaseContext class];
+ [[NSNotificationCenter defaultCenter]
+ addObserver: self
+ selector: @selector(_registerDatabaseContext:)
+ name: EOCooperatingObjectStoreNeeded
+ object: nil];
+ }
}
+ (EODatabaseContext*)databaseContextWithDatabase: (EODatabase *)database
- [Fwd: RFC GDL2: move +load implementations to +initialize],
David Ayers <=