SN-10219 附来源、原文与上下文。
我曾短暂地复现这个问题,并把范围缩小到下面代码中的“mapAddresses.count”。这绝对是最后才加进去的一段代码,基本上只在 MSVC 编译的版本中测试过。它不是必需的;在弄清楚原因之前,我倾向于关闭优化,并删掉这段代码。
I was temporarily able to reproduce the bug and narrowed it down to the "mapAddresses.count" in the following code. It was absolutely the last piece of code to go in and mainly only got tested with the MSVC build. It's not essential and I'm inclined to turn off optimization and delete the section of code until I figure out what's going on.
随信附上一个调试版 exe,你可以试试。这个版本删掉了那行代码,并关闭了优化。目前我又没法复现这个问题了。
I'm attaching a dbg exe you can try that deletes the line of code and turns off optimization. I'm not able to reproduce it anymore at the moment.
irc.cpp:
irc.cpp:
if (pszName[0] == 'u')
{
CAddress addr;
if (DecodeAddress(pszName, addr))
{
CAddrDB addrdb;
if (AddAddress(addrdb, addr))
printf("new ");
else
{
// make it try connecting sooner
CRITICAL_BLOCK(cs_mapAddresses)
if (mapAddresses.count(addr.GetKey()))
mapAddresses[addr.GetKey()].nLastFailed = 0;
}
addr.print();
}
else
{
printf("decode failed\n");
}
}
if (pszName[0] == 'u')
{
CAddress addr;
if (DecodeAddress(pszName, addr))
{
CAddrDB addrdb;
if (AddAddress(addrdb, addr))
printf("new ");
else
{
// make it try connecting sooner
CRITICAL_BLOCK(cs_mapAddresses)
if (mapAddresses.count(addr.GetKey()))
mapAddresses[addr.GetKey()].nLastFailed = 0;
}
addr.print();
}
else
{
printf("decode failed\n");
}
}
引用 Hal Finney 的来信Hal Finney来源 ↗是的,其实带 MSVC 调试符号的版本更好,我用的就是它。
Yes, actually the version with MSVC symbols would be better, that is the one I am using.
我发现,从 cygwin shell 启动这个版本时,它不会崩溃。但如果在 Windows 中双击文件启动,它就会像上一个版本一样崩溃。不过,我很确定,上一个版本即使从 cygwin 启动也会崩溃。
I found that if I launched this one from a cygwin shell, it does not crash. But if I launch it from Windows, double-clicking on the file, it does crash similarly to the previous version. However, I am pretty sure that the previous version did crash even when I launched it from cygwin.
我得出门了,不过会让这个版本继续运行一阵子。
I have to go out but I'll leave this version running for a while.
Hal
Hal