From aa38b1c65277045927ccd00aa930aba2778147fd Mon Sep 17 00:00:00 2001 From: helge Date: Fri, 4 Mar 2005 14:07:57 +0000 Subject: [PATCH] fixed duplicate -awake git-svn-id: http://svn.opengroupware.org/SOPE/trunk@614 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- sope-appserver/NGObjWeb/ChangeLog | 7 ++++++- sope-appserver/NGObjWeb/Version | 2 +- sope-appserver/NGObjWeb/WOComponent.m | 18 +++++++++++++++--- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/sope-appserver/NGObjWeb/ChangeLog b/sope-appserver/NGObjWeb/ChangeLog index df21ebba..5214aff7 100644 --- a/sope-appserver/NGObjWeb/ChangeLog +++ b/sope-appserver/NGObjWeb/ChangeLog @@ -1,7 +1,12 @@ +2005-03-04 Helge Hess + + * WOComponent.m: protect component against duplicate -awake in the + same context as suggested by Stephane (v4.5.124) + 2005-03-03 Helge Hess * DynamicElements/WOMetaRefresh.m: added support for 'seconds' binding - as available in WO (v4.5.123) + as available in WO and suggested by Stephane (v4.5.123) 2005-03-01 Helge Hess diff --git a/sope-appserver/NGObjWeb/Version b/sope-appserver/NGObjWeb/Version index cd961881..b4b46d80 100644 --- a/sope-appserver/NGObjWeb/Version +++ b/sope-appserver/NGObjWeb/Version @@ -1,6 +1,6 @@ # version file -SUBMINOR_VERSION:=123 +SUBMINOR_VERSION:=124 # v4.5.122 requires libNGExtensions v4.5.153 # v4.5.91 requires libNGExtensions v4.5.134 diff --git a/sope-appserver/NGObjWeb/WOComponent.m b/sope-appserver/NGObjWeb/WOComponent.m index a21d60fe..ab567889 100644 --- a/sope-appserver/NGObjWeb/WOComponent.m +++ b/sope-appserver/NGObjWeb/WOComponent.m @@ -135,7 +135,7 @@ static BOOL wakeupPageOnCreation = NO; - (id)initWithContext:(WOContext *)_ctx { [self _setContext:_ctx]; if ((self = [self init])) { - if (self->context) + if (self->context != nil) [self ensureAwakeInContext:self->context]; else { [self warnWithFormat: @@ -268,7 +268,19 @@ static inline id _getExtraVar(WOComponent *self, NSString *_key) { if (debugComponentAwake) [self debugWithFormat:@"0x%08X ensureAwakeInContext:0x%08X", self, _ctx]; - if (self->context == nil) [self _setContext:_ctx]; + /* sanity check */ + + if (self->componentFlags.isAwake) { + if (self->context == _ctx) { + if (debugComponentAwake) + [self debugWithFormat:@"0x%08X already awake:0x%08X", self, _ctx]; + return; + } + } + + /* setup globals */ + + if (self->context == nil) [self _setContext:_ctx]; if (self->application == nil) self->application = [_ctx application]; if ((self->session == nil) && [_ctx hasSession]) @@ -283,7 +295,7 @@ static inline id _getExtraVar(WOComponent *self, NSString *_key) { WOComponent *child; children = [self->subcomponents objectEnumerator]; - while ((child = [children nextObject])) + while ((child = [children nextObject]) != nil) [child _awakeWithContext:_ctx]; } -- 2.39.5