Re: Cocoa-dev Digest, Vol 5, Issue 268

  • Thanks Bill & Hamish,

    Changing the init method worked. I am still a little puzzled though.
    I later renamed the ivar to localDataCopy (which certainly wouldn't
    be a part of the NSWindow class), and the same error occurred. My
    accessors definitely assume an NSMutableDictionary. Does that mean a
    memory-munching bug????

    In any case, it works fine. now. Thanks.

    Daniel

    On Feb 19, 2008, at 3:04 PM, <cocoa-dev-request...> wrote:

    > Hamish is correct in that this should be structured something like:
    >
    > - init
    > {
    > if (self = [super initWithWindowNibName: @"Step1Window"]) {
    > data = [[NSMutableDictionary alloc] init];
    > }
    > return self;
    > }
    >
    > Given that you declared the instance variable in the class w/the init,
    > super better not be replacing your ivar!
    >
    > So, how could data become a non-mutable object?
    >
    > (1) Unarchival generally produces immutable objects unless you
    > explicitly ask for mutable objects.
    >
    > (2) You released data and replaced it with a reference to an immutable
    > object
    >
    > (3) You have a memory munching bug
  • On Feb 19, 2008, at 2:18 PM, Daniel Child wrote:
    > Changing the init method worked. I am still a little puzzled though.
    > I later renamed the ivar to localDataCopy (which certainly wouldn't
    > be a part of the NSWindow class), and the same error occurred. My
    > accessors definitely assume an NSMutableDictionary. Does that mean a
    > memory-munching bug????
    >
    > In any case, it works fine. now. Thanks.

    It sounds like maybe that -initWithNibName: didn't return the same
    instance?

    Oh, wait, if you renamed the instance variable and it stopped working,
    that definitely sounds like a memory stomper or unarchival issue.

    Very strange -- can't tell you much more without seeing more code.

    b.bum