Qt Creator clipboard-related hang on Macintosh
We are using Qt 5.9.4 and Qt Creator 4.4.0 to debug a 64-bit application on Mac OS.
We consistently get a hang when we hit a breakpoint if we happen to copy text to the clipboard before we hit the breakpoint. The same thing happens if we crash after copying to the clipboard. Qt Creator hangs for 3 to 20 minutes during which time we get a spinning pizza. Eventually, Qt Creator becomes responsive and we can continue. This issue is a significant impediment for debugging.
I believe that the hang is related to Macintosh clipboard "promises" fulfilled by QMacPasteboard::promiseKeeper in qmacclipboard.mm, but I don't know exactly why it happens or how to avoid it.
I can reproduce the hang using the qtbase/examples/widgets/textedit example program as follows:
Open the qtbase/examples/widgets/textedit project in Qt Creator and launch the debug configuration.
Set a breakpoint at the start of TextEdit::fileOpen in textedit.cpp.
In the Qt textedit example program, select some text from the sample document and copy it to the clipboard.
Choose File->Open File.
On my machine, this hung Qt Creator with a spinning pizza for 12 minutes.
When Qt Creator finally responded, I continued the application and repeated the test with a similar result - a 3-minute delay before breaking.
You can avoid the problem by activating Qt Creator after copying the text in the Qt textedit example but before the breakpoint is hit, if you remember to activate Qt Creator before you trigger the hang.
I'm not sure if this qualifies as a Qt bug and I did not find any bug reports about it. Perhaps someone in this forum has a suggestion.
Since you can trigger it at will then I'd say it's worth opening a report.
What version of macOS are you using ?
Does it also happen with a more recent version of Qt Creator ?
I am running Mac OS 10.13.2. (I see 10.13.3 is now available.)
I updated to Qt Creator 4.5.2 and the problem remains.
I have filed a bug report:
Can you also give a shot to Qt Creator 4.6 RC ?
I get the same behavior (hang) with Qt Creator 4.6.0-rc1.
Ok, thanks for testing !