Reputation: 11
I'm developping a C++ Qt desktop application for Windows. I'm using the version 6.4 of Qt and I compile the code with MSVC 2019 (19.29.30146 for x64).
I would like to be able to copy a text from the Qt application and to paste it in another program (like Notepad++). Unfortunately, as soon as I try to paste the content of the clipboard, I got the " 0xC0000374 A heap has been corrupted" error.
The code I use to make a very simple test is the following:
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();
}
Does anyone encounter the same problem? Any ideas to solve this?
Thanks in advance.
Upvotes: 0
Views: 59
Reputation: 11
I discovered that the "heap has been corrupted" error occurs only when the MSVC Sanitizer is actived (i.e. when the option -fsanitize=address is passed to the compiler).
As long as I compile with the "normal" Debug mode, everything works fine.
Upvotes: 1