我点击了这个错误“malloc:*** auto malloc [731]:错误:未注册线程上的GC操作。隐式注册了线程。中断auto_zone_thread_registration_error()进行调试。”
我的应用程序是这样的,当用户双击NSTableView中的一行时,它将从该行获取一个URL,然后要求WebView从该URL加载页面:
[tableView setDoubleAction:@selector(doubleClickAction:)];
...
- (IBAction)doubleClickAction:(id)sender {
...
/* cause that malloc error */
[[webView mainFrame] loadRequest: [NSURLRequest requestWithURL: row.url]];
}
那我该如何解决呢?
谢谢!
答案 0 :(得分:4)
所以我得到了https://bugs.webkit.org/show_bug.cgi?id=59938的答复,“这已经在r81825中修复了。这是一条无害的信息,可以忽略。”
答案 1 :(得分:1)
将此objc_registerThreadWithCollector();
添加到您的pthread。如果您找不到符号或链接错误,请使用以下代码
#include <dlfcn.h>
void (*registerThreadWithCollector_fn)(void);
registerThreadWithCollector_fn = (void(*)(void)) dlsym(RTLD_NEXT, "objc_registerThreadWithCollector");
if (registerThreadWithCollector_fn) {
(*registerThreadWithCollector_fn)();
} else {
// do something else
}