我已经调试了 2 个小时了,归结为这一点。如果我打电话QString::toStdString
QString s = "testtesttesttesttesttest";
const std::string &temp = s.toStdString();
该程序后来在 std::string 析构函数上崩溃
__CLR_OR_THIS_CALL ~basic_string()
{ // destroy the string
_Tidy(true); // <---- It crashes on this line.
}
起初我以为是内存损坏,但即使main()
只包含那 2 行也会发生这种情况。有谁知道为什么会发生这种情况,以及我该如何解决?
我的 Qt 版本是4.8.1
.