• 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: App crashes when launched from finder, but not when launched from debugger or command line
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: App crashes when launched from finder, but not when launched from debugger or command line


  • Subject: Re: App crashes when launched from finder, but not when launched from debugger or command line
  • From: Ken Thomases <email@hidden>
  • Date: Mon, 17 Nov 2008 07:35:54 -0600

On Nov 17, 2008, at 4:10 AM, Rick Mann wrote:

I have a Carbon app that exhibits a crash when launched either by double-clicking it in the Finder, or clicking on its dock icon. But if I launch it from within Xcode (with debugger), or by executing the Contents/MacOS/<executable>, or by using the "open" command-line tool, it works fine.

The crash occurs when bringing up a utility window. It always happens in the same place, a Nano framework method called NHIWindow::Select(). This method is straightforward:


void NHIWindow::Select(bool makeVisible) { // Select the window SelectWindow(mWindow); if (makeVisible) SetVisible(true); }

I call this method successfully on other windows in my app without trouble. The window that causes the crash is a floating utility window. When I look at the values of things like this and mWindow, they look sane. I tried printf-ing their values in this method, but nothing prints in the crash. I've included a crash report.

The crash report looks like "this" is NULL. That is, you're calling this method on a NULL object pointer. When the method attempts to access the mWindow member variable, that's when the access violation occurs.


So, the problem is not at the point of the crash. The problem occurred earlier and was only exposed by the crash.


Any ideas? What's different about the four different ways of launching the file?

The main difference is that, when launched by Xcode or executing Contents/MacOS/<executable>, your program inherits its environment from the parent process, including environment variables and the current working directory.


When launched from the Finder or Dock, your program receives a very basic environment from launchd.

Using "open" used to cause the program to inherit the caller's environment in Tiger, but since Leopard it should gets the basic environment from launchd. It _should_ be identical to launching it from the Finder. I'm not sure why your experience suggests differently. Were you testing on Tiger?

Regards,
Ken

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: App crashes when launched from finder, but not when launched from debugger or command line
      • From: Rick Mann <email@hidden>
References: 
 >App crashes when launched from finder, but not when launched from debugger or command line (From: Rick Mann <email@hidden>)

  • Prev by Date: App crashes when launched from finder, but not when launched from debugger or command line
  • Next by Date: Re: App crashes when launched from finder, but not when launched from debugger or command line
  • Previous by thread: App crashes when launched from finder, but not when launched from debugger or command line
  • Next by thread: Re: App crashes when launched from finder, but not when launched from debugger or command line
  • Index(es):
    • Date
    • Thread