diff --git a/lib/arch/CArchMultithreadWindows.cpp b/lib/arch/CArchMultithreadWindows.cpp index 2a457a50..f156021f 100644 --- a/lib/arch/CArchMultithreadWindows.cpp +++ b/lib/arch/CArchMultithreadWindows.cpp @@ -753,9 +753,6 @@ CArchMultithreadWindows::doThreadFunc(CArchThread thread) lockMutex(m_threadMutex); unlockMutex(m_threadMutex); - // default priority is slightly below normal - setPriorityOfThread(thread, 1); - void* result = NULL; try { // go diff --git a/lib/mt/CThread.cpp b/lib/mt/CThread.cpp index fcf6832c..b2463e8b 100644 --- a/lib/mt/CThread.cpp +++ b/lib/mt/CThread.cpp @@ -170,8 +170,13 @@ CThread::threadFunc(void* vjob) result = e.m_result; LOG((CLOG_DEBUG1 "caught exit on thread 0x%08x, result %p", id, result)); } + catch (XBase& e) { + LOG((CLOG_ERR "exception on thread 0x%08x: %s", id, e.what())); + delete job; + throw; + } catch (...) { - LOG((CLOG_DEBUG1 "exception on thread 0x%08x", id)); + LOG((CLOG_ERR "exception on thread 0x%08x: ", id)); delete job; throw; } diff --git a/lib/platform/CXWindowsClipboard.cpp b/lib/platform/CXWindowsClipboard.cpp index de463546..0606c3ef 100644 --- a/lib/platform/CXWindowsClipboard.cpp +++ b/lib/platform/CXWindowsClipboard.cpp @@ -1049,27 +1049,60 @@ CXWindowsClipboard::sendReply(CReply* reply) LOG((CLOG_DEBUG1 "clipboard: sending notify to 0x%08x,%d,%d", reply->m_requestor, reply->m_target, reply->m_property)); reply->m_replied = true; - // HACK -- work around apparent bug in lesstif, which doesn't - // wait around for the SelectionNotify then gets confused when - // it sees it the next time it requests the selection. if it - // looks like a lesstif requestor window then don't send the - // SelectionNotify. it looks like a lesstif requestor if: - // it has a _MOTIF_CLIP_LOCK_ACCESS_VALID property - // it does not have a GDK_SELECTION property - CString dummy; - if (m_id != kClipboardClipboard || - !CXWindowsUtil::getWindowProperty(m_display, + // dump every property on the requestor window to the debug2 + // log. we've seen what appears to be a bug in lesstif and + // knowing the properties may help design a workaround, if + // it becomes necessary. + if (CLOG->getFilter() >= CLog::kDEBUG2) { + CXWindowsUtil::CErrorLock lock(m_display); + int n; + Atom* props = XListProperties(m_display, reply->m_requestor, &n); + LOG((CLOG_DEBUG2 "properties of 0x%08x:", reply->m_requestor)); + for (int i = 0; i < n; ++i) { + Atom target; + CString data; + char* name = XGetAtomName(m_display, props[i]); + if (!CXWindowsUtil::getWindowProperty(m_display, reply->m_requestor, - m_atomMotifClipAccess, - &dummy, NULL, NULL, False) || - CXWindowsUtil::getWindowProperty(m_display, - reply->m_requestor, - m_atomGDKSelection, - &dummy, NULL, NULL, False)) { - sendNotify(reply->m_requestor, m_selection, + props[i], &data, &target, NULL, False)) { + LOG((CLOG_DEBUG2 " %s: ", name)); + } + else { + // if there are any non-ascii characters in string + // then print the binary data. + static const char* hex = "0123456789abcdef"; + for (CString::size_type j = 0; j < data.size(); ++j) { + if (data[j] < 32 || data[j] > 126) { + CString tmp; + tmp.reserve(data.size() * 3); + for (j = 0; j < data.size(); ++j) { + unsigned char v = (unsigned char)data[j]; + tmp += hex[v >> 16]; + tmp += hex[v & 15]; + tmp += ' '; + } + data = tmp; + break; + } + } + char* type = XGetAtomName(m_display, target); + LOG((CLOG_DEBUG2 " %s (%s): %s", name, type, data.c_str())); + if (type != NULL) { + XFree(type); + } + } + if (name != NULL) { + XFree(name); + } + } + if (props != NULL) { + XFree(props); + } + } + + sendNotify(reply->m_requestor, m_selection, reply->m_target, reply->m_property, reply->m_time); - } } // wait for delete notify