• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
[CoreData] Undo of insert - how to close the removed object's window?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[CoreData] Undo of insert - how to close the removed object's window?


  • Subject: [CoreData] Undo of insert - how to close the removed object's window?
  • From: Kaspar Fischer <email@hidden>
  • Date: Tue, 15 Nov 2005 10:43:49 +0100

  Hi all,

  My CoreData document maintains a list of books (the
list is an attribute called "books") and each book may
have an associated window (displaying the book's details).

  Now if I add a book, open its window, and perform undo,
I want (i) the book to be removed again (CoreData does
this automatically for me) and (ii) to have the window
closed.

  I implemented this by observing the "books" attribute
of my "project" entity: whenever the "books" set changes,
I observe this and step through all windows, closing the
ones that have been removed.

  This has one problem: although I remove the window,
it and its subviews are not immediately released (I guess
they are only autoreleased and will be deallocated at
the end of the event loop). As a conequence, my subviews
-dealloc methods are not called, and as these unbind
several bindings, I end up with a closed window that
still has active bindings in some subviews.

  The result is that CoreData sends change notifications
to the controllers of these bindings -- and this of course
results in a crash because the bindings are still here,
but the book has already been removed!

  I think this is a general pattern, and I would like
to ask if anybody has a solution for it? The pattern is:
in a model, some objects may have an associated window;
how can I make sure that the window gets closed if the
objects are removed due to undo/redo?

  Very curious for solutions,
  Kaspar
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: [CoreData] Undo of insert - how to close the removed object's window?
      • From: mmalcolm crawford <email@hidden>
  • Prev by Date: Re: How to see the arguments of methods from the stack trace during debugging
  • Next by Date: Re: Volunteers to test on 10.2
  • Previous by thread: Re: How to Draw View back ground like iCal Task background color
  • Next by thread: Re: [CoreData] Undo of insert - how to close the removed object's window?
  • Index(es):
    • Date
    • Thread