diff options
author | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2013-02-26 13:31:01 (GMT) |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-08-19 12:42:54 (GMT) |
commit | 3f67fd3cbfe6804614dc5be7c64bef2fa8af180a (patch) | |
tree | d6be3b270fb2abd95e42b5ce38e30792070a4319 /src/gui/kernel | |
parent | 6d47f5a168e350a6d9cbddb343ff9d75ffbd2c04 (diff) | |
download | Qt-3f67fd3cbfe6804614dc5be7c64bef2fa8af180a.zip Qt-3f67fd3cbfe6804614dc5be7c64bef2fa8af180a.tar.gz Qt-3f67fd3cbfe6804614dc5be7c64bef2fa8af180a.tar.bz2 |
Do not send clipboard message to application under debugger.
Fix Qt Creator hang when copying a stack trace from an
application showing a runtime assert.
Change-Id: I874bd48643ebce1a3551644dc850cb7cf5869522
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
(cherry picked from qtbase/333817b9cf1304cca7c1dbd45880115cd128f60e)
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qclipboard_win.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/gui/kernel/qclipboard_win.cpp b/src/gui/kernel/qclipboard_win.cpp index 4ac59ef..5c36c09 100644 --- a/src/gui/kernel/qclipboard_win.cpp +++ b/src/gui/kernel/qclipboard_win.cpp @@ -300,6 +300,24 @@ void QClipboard::clear(Mode mode) #endif } +#if !defined(Q_OS_WINCE) && defined(Q_CC_MSVC) +static bool isProcessBeingDebugged(HWND hwnd) +{ + DWORD pid = 0; + if (!GetWindowThreadProcessId(hwnd, &pid) || !pid) + return false; + const HANDLE processHandle = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, pid); + if (!processHandle) + return false; + BOOL debugged = FALSE; + CheckRemoteDebuggerPresent(processHandle, &debugged); + CloseHandle(processHandle); + return debugged != FALSE; +} +#else // !defined(Q_OS_WINCE) && defined(Q_CC_MSVC) +static bool isProcessBeingDebugged(HWND) { return false; } +#endif // defined(Q_OS_WINCE) || !defined(Q_CC_MSVC) + bool QClipboard::event(QEvent *e) { if (e->type() != QEvent::Clipboard) @@ -338,6 +356,10 @@ bool QClipboard::event(QEvent *e) } if (ptrIsHungAppWindow && ptrIsHungAppWindow(d->nextClipboardViewer)) { qWarning("%s: Cowardly refusing to send clipboard message to hung application...", Q_FUNC_INFO); + } else if (isProcessBeingDebugged(d->nextClipboardViewer)) { + // Also refuse if the process is being debugged, specifically, if it is + // displaying a runtime assert, which is not caught by isHungAppWindow(). + qWarning("%s: Cowardly refusing to send clipboard message to application under debugger...", Q_FUNC_INFO); } else { SendMessage(d->nextClipboardViewer, m->message, m->wParam, m->lParam); } |