什么可能导致 -[NSPasteboard types] 崩溃?
我们的一位客户有时在粘贴时会遇到这样的崩溃:
0 com.apple.Foundation 0x9143bd1d readPointerAt + 9
1 com.apple.Foundation 0x9153221f empty + 43
2 com.apple.Foundation 0x9145d41f dealloc + 21
3 com.apple.Foundation 0x9145d3ce -[NSConcreteMapTable dealloc] + 35
4 com.apple.AppKit 0x9092aa5d -[_NSPasteboardOwnersCollection dealloc] + 45
5 com.apple.AppKit 0x905cdb8f _NSPasteboardReportChangedOwner + 66
6 com.apple.AppKit 0x905cd4aa -[NSPasteboard _updateTypeCacheIfNeeded] + 51
7 com.apple.AppKit 0x905cd361 -[NSPasteboard _typesAtIndex:usesPboardTypes:] + 52
8 com.apple.AppKit 0x905cd327 -[NSPasteboard types] + 50
有人知道什么可能导致这种情况吗?
- 据我所知,粘贴板对象是有效的,但随后在内部崩溃了。
- 我认为这通常是从另一个应用程序粘贴时发生的,是否有可能另一个应用程序对粘贴板的所有权管理不当?
来自 Does NSPasteboardretainownerobjects? 的更多信息说是的,粘贴板保留所有者传递给它。因此,这次崩溃必须是:
- 我的代码中的过度发布。这会导致对象被释放,而粘贴板仍然保留对其的引用。我认为这不太可能,因为您希望问题独立于粘贴板而出现,而且我还没有看到任何崩溃(报告)表明这一点。
NSPasteboard
管理跨应用程序粘贴的方式出现问题并崩溃。有人遇到过类似的事情或者知道可能是什么原因造成的吗?
One of our customers is seeing a crash like this sometimes when pasting:
0 com.apple.Foundation 0x9143bd1d readPointerAt + 9
1 com.apple.Foundation 0x9153221f empty + 43
2 com.apple.Foundation 0x9145d41f dealloc + 21
3 com.apple.Foundation 0x9145d3ce -[NSConcreteMapTable dealloc] + 35
4 com.apple.AppKit 0x9092aa5d -[_NSPasteboardOwnersCollection dealloc] + 45
5 com.apple.AppKit 0x905cdb8f _NSPasteboardReportChangedOwner + 66
6 com.apple.AppKit 0x905cd4aa -[NSPasteboard _updateTypeCacheIfNeeded] + 51
7 com.apple.AppKit 0x905cd361 -[NSPasteboard _typesAtIndex:usesPboardTypes:] + 52
8 com.apple.AppKit 0x905cd327 -[NSPasteboard types] + 50
Does anyone have any idea what could cause this?
- The pasteboard object is valid as far as I can tell but then crashes internally.
- I think this is generally when pasting from another app, is it possible the other app is mismanaging its ownership of the pasteboard?
Further information from Does NSPasteboard retain owner objects? says that yes, the pasteboard retains the owners passed to it. Therefore, this crash must be either:
- An over-release in my code. This causes an object to be deallocated while the pasteboard still holds a reference to it. I think this unlikely as you'd expect the problem to show up independent of the pasteboard, and I've not seen a single crash (report) to suggest that.
- Something in the way
NSPasteboard
manages cross-application pastes is going wrong and crashing. Anyone encountered something like that or know what could cause it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这似乎是在处理有关先前所有者的信息时(在用户最新副本设置的当前所有者之前)。也许那就是你?检查您的复制代码。
如果还没有的话,还可以在 Zombies 工具下运行您的应用程序。
That appears to be when disposing of information about the previous owner (before the current owner as set by the user's most recent copy). Perhaps that's you? Check your copying code.
Also run your app under the Zombies instrument, if you haven't already.
如果您接受拖动粘贴的拖放并在另一个线程中异步执行实际工作,则应该保留粘贴板本身,否则,当主线程中的函数返回时,它可能会被释放。
它可能发生在拖动源端。
例如:
}
If you accept a drop from a dragging paste and do the actual work asynchronously in another thread, you should retain the pasteboard itself, or otherwise, it might be deallocated when the function in the main thread returns.
It can probably happen in the dragging source side.
For example:
}