I do the following:
1) Copy the data to the clipboard in my Qt program on Windows.
QApplication::clipboard()->setText(data);
2) Paste the data into an external program (notepad.exe). After that, my program starts processing the clipboard data. It calls special Windows methods:
QWindowsOleDataObject::GetData(...); ... QWindowsMimeText::convertFromMime(...);
This is a problem because when the size of the data in the clipboard is large, my program crashes when allocating memory in these methods.
I cannot understand this because the call stack is rather strange:
qwindowsd.dll!QWindowsMimeText::convertFromMime(const tagFORMATETC & formatetc, const QMimeData * mimeData, tagSTGMEDIUM * pmedium) Line 606 C++ qwindowsd.dll!QWindowsOleDataObject::GetData(tagFORMATETC * pformatetc, tagSTGMEDIUM * pmedium) Line 144 C++ [External Code] Qt5Cored.dll!QEventDispatcherWin32::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 740 C++ qwindowsd.dll!QWindowsGuiEventDispatcher::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 73 C++ Qt5Cored.dll!QEventLoop::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 129 C++ Qt5Cored.dll!QEventLoop::exec(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 204 C++ Qt5Cored.dll!QCoreApplication::exec() Line 1188 C++ Qt5Guid.dll!QGuiApplication::exec() Line 1508 C++ Qt5Widgetsd.dll!QApplication::exec() Line 2957 C++ main(int argc, char * * argv) Line 759 C++
This is some kind of internal work of Qt, I don’t know how to influence it.
source share