![](/img/trans.png)
[英]program has triggered a breakpoint, Unhandled exception at 0x77239D11 (ntdll.dll): 0xC0000374: A heap has been corrupted (parameters: 0x7726D8D0)
[英]C++ QClipboard : trying to copy text from Qt application and to paste in Notepad++ raises 0xC0000374 A heap has been corrupted error
我正在為 Windows 開發 C++ Qt 桌面應用程序。 我使用的是 Qt 6.4 版,並使用 MSVC 2019(x64 為 19.29.30146)編譯代碼。
我希望能夠從 Qt 應用程序復制文本並將其粘貼到另一個程序(如 Notepad++)中。 不幸的是,當我嘗試粘貼剪貼板的內容時,我收到了“0xC0000374 A heap has been corrupted”錯誤。
我用來做一個非常簡單的測試的代碼如下:
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
...
QClipboard *clipboard = QGuiApplication::clipboard();
clipboard->setText("random text");
MainWindow main_window;
main_window.show();
return app.exec();
}
有沒有人遇到同樣的問題? 有解決這個問題的想法嗎?
提前致謝。
I discovered that the "heap has been corrupted" error occurs only when the MSVC Sanitizer is actived (ie when the option -fsanitize=address is passed to the compiler).
只要我用“正常”調試模式編譯,一切正常。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.