Hi,

I have a relationship between two of my model objects. TFField has a 
pickList property:

TFField -> TFPickList

With an inverse one-to-many relationship called fields between TFPickList 
and TFField:

TFPickList ->> TFField

When I am deallocating an instance of one of my GUI classes, I do a check 
to see what kind of TFPickList object I'm dealing with and then I do some 
additional stuff before dealloc finishes. What I've found is simply by 
traversing the relationship to determine if a pickList object exists on the 
TFField object, a new TFPickList instance is being created for me. It's not 
what I was expecting.

My dealloc is simply:

- (void)dealloc {

       if (self.field.pickList.isPopupButton) {

               [self.currentCellView.popupButton unbind:@"selectedValue"];

               [self.currentCellView.popupButton unbind:@"content"];

               [self.currentCellView.popupButton unbind:@"contentValues"];

       }

}

As soon as self.field.pickList.isPopupButton is called, CBL tries to create 
a TFPickList object:

#0 0x00000001003c7496 in -[TFPickList awakeFromInitializer] at 
TFPickList.m:38
#1 0x0000000100c93861 in -[CBLModel initWithDocument:orDatabase:] at 
CBLModel.m:52
#2 0x0000000100c93d4b in +[CBLModel modelForDocument:] at CBLModel.m:86
#3 0x0000000100c96836 in -[CBLModel modelWithDocID:forProperty:ofClass:] at 
CBLModel.m:540
#4 0x0000000100ca0853 in -[CBLModel(Properties) getModelProperty:] at 
CBLModel+Properties.m:120
#5 0x00000001004074c9 in -[TextCellController dealloc] at 
TextCellController.m:329



And then the TFPickList instance gets deallocated, but with unsaved 
properties:

*TFPickList[pik-..f47a] deallocated with unsaved changes.*

*2016-03-27 12:44:01.499 Tap Forms[52964:1215713] properties to save: {*

*    "_id" = "pik-439f938ddaf845568ee2b853493cf47a";*

*    displayAs = single;*

*    name = "New Pick List";*

*}*

I have an inverse relationship defined on my TFPickList class and TFField 
as follows:

+ (Class)fieldsItemClass { return [TFField class]; }

+ (NSString *)fieldsInverseRelation { return @"pickList"; }

So I'm just wondering if it's normal behaviour for an object in a 
 relationship to get created simply by following the path to that 
relationship? I would think that it shouldn't automatically be created.

What could be causing this and is there something I should do about it? Or 
should I just ignore it since the unneeded instance is getting deallocated 
anyway. 

Seems like a bug to me though. Either that or I'm doing something wrong.

Thanks,

Brendan

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/3b928539-9abf-4413-b4d1-521832d958ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to