1

I'm using Xcode 5.1.1 on OSX 10.9.4 to debug a Cocoa + OpenGL application. So far I've only ever run my app under the Xcode debugger. Last week I exited Xcode only to find an icon for my app still sitting in the Dock. Using Show In Finder led me to a debug executable inside Xcode's DerivedData. I eventually power cycled to get rid of it (more on that) and all was well until today. But I now have two of these icons sitting in my Dock.

The problem: these apps cannot be killed! Force Quit does nothing. They don't show up in the process list using 'ps aux' or Activity Monitor. A Restart just gets stuck in a loop trying to get rid of them. Only forcibly power-cycling the Mac works.

According to NSWorkspace's runningApplication method there are NSRunningApplication instances associated with these apps. But the process id's don't correspond to actual processes. Nothing relevant in the Console logs.

Anyone else ever encounter this? Any suggestions for getting NSWorkspace to get rid of bogus NSRunningApplication instances?

4

1 に答える 1

1

編集:問題の根本原因を発見しました!疑似ゾンビ Dock NSRunningApplication を「所有」していたアプリIOObjectRelease()は、IORegistryEntryGetChildIterator(). ああ、これを最終的に追跡するのに数か月かかりました。基本的に、ブレークポイントを使用して、アプリが他のアプリの NSRunningApplication を「疑似ゾンビ化」した正確な瞬間のバイナリ検索を行いました。IORegistry の繰り返しが NSRunningApplication をハイジャックする理由をまだ理解していません。


これは私のためにそれを修正します:

sudo killall launchservicesd; sudo killall Dock; sudo killall Finder;

または.bashrcで:

alias killdock="sudo killall launchservicesd; sudo killall Dock; sudo killall Finder;"

注: Finder も強制終了しないと、'Reveal In Finder...'[[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs:urls];がアプリで機能しなくなります。

于 2016-01-29T16:47:39.343 に答える