• 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
Re: First cocoa app & crashes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: First cocoa app & crashes


  • Subject: Re: First cocoa app & crashes
  • From: Buzz Andersen <email@hidden>
  • Date: Mon, 18 Nov 2002 11:01:16 -0700

Oli,
There are two problems at work in your program:

1. You are exactly right about why your GUI locks up. The answer is to make it multithreaded (see NSThread), and have your "sucking" happen in a separate thread. If you do implement such a solution, however, just remember that the AppKit is *not* thread safe, and therefore if you want to communicate between threads (for example, to have the "sucker" class running in the second thread update a progress indicator on the GUI running in the main thread), you have two options:

- Use distributed objects (see documentation or the list archives at cocoa.mamasam.com for more information).
- In 10.2, use NSObject's "performSelectorOnMainThread:withObject:waitUntilDone:" method, which will save you the trouble of distributed objects but somewhat limit your architectural options (in that everything has to be in the same class).

2. Regarding your crash problem, it is difficult to say what the problem is without seeing your code, but I can tell you this: when you see that type 10 or 11 error it is (at least in my experience) almost always because you released something you shouldn't have. I would look very carefully at your code and think about all of your "releases" and whether you might be releasing one of your objects one too many times. I would definitely look at the crash log and try to determine which release actually caused the problem.

Reading this article might be of some help, if you fell like you need more clarification on the whole retain/release thing (I sure did at first :-):

http://www.stepwise.com/Articles/Technical/2001-03-11.01.html

Hope this helps somewhat...

--
Buzz Andersen
email: email@hidden
web: http://www.scifihifi.com
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: First cocoa app & crashes
      • From: Michael Norris <email@hidden>
  • Prev by Date: Re: ColorWell sending action multiple times
  • Next by Date: Re: Close button on Single Window Utilities
  • Previous by thread: First cocoa app & crashes
  • Next by thread: Re: First cocoa app & crashes
  • Index(es):
    • Date
    • Thread