mirror of
https://github.com/crystalidea/qt6windows7.git
synced 2025-07-03 07:45:30 +08:00
update to Qt 6.7.3
This commit is contained in:
@ -112,8 +112,10 @@ static GUID writableSpecialFolderId(QStandardPaths::StandardLocation type)
|
||||
FOLDERID_LocalAppData, // AppConfigLocation ("Local" path)
|
||||
FOLDERID_Public, // PublicShareLocation
|
||||
FOLDERID_Templates, // TemplatesLocation
|
||||
GUID(), // StateLocation
|
||||
GUID(), // GenericStateLocation
|
||||
};
|
||||
static_assert(sizeof(folderIds) / sizeof(folderIds[0]) == size_t(QStandardPaths::TemplatesLocation + 1));
|
||||
static_assert(sizeof(folderIds) / sizeof(folderIds[0]) == size_t(QStandardPaths::GenericStateLocation + 1));
|
||||
|
||||
// folders for low integrity processes
|
||||
static const GUID folderIds_li[] = {
|
||||
@ -137,6 +139,8 @@ static GUID writableSpecialFolderId(QStandardPaths::StandardLocation type)
|
||||
FOLDERID_LocalAppDataLow,// AppConfigLocation ("Local" path)
|
||||
FOLDERID_Public, // PublicShareLocation
|
||||
FOLDERID_Templates, // TemplatesLocation
|
||||
GUID(), // StateLocation
|
||||
GUID(), // GenericStateLocation
|
||||
};
|
||||
static_assert(sizeof(folderIds_li) == sizeof(folderIds));
|
||||
|
||||
@ -191,6 +195,23 @@ QString QStandardPaths::writableLocation(StandardLocation type)
|
||||
result = QDir::tempPath();
|
||||
break;
|
||||
|
||||
case StateLocation:
|
||||
result = sHGetKnownFolderPath(writableSpecialFolderId(AppLocalDataLocation));
|
||||
if (!result.isEmpty()) {
|
||||
appendTestMode(result);
|
||||
appendOrganizationAndApp(result);
|
||||
result += "/State"_L1;
|
||||
}
|
||||
break;
|
||||
|
||||
case GenericStateLocation:
|
||||
result = sHGetKnownFolderPath(writableSpecialFolderId(GenericDataLocation));
|
||||
if (!result.isEmpty()) {
|
||||
appendTestMode(result);
|
||||
result += "/State"_L1;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
result = sHGetKnownFolderPath(writableSpecialFolderId(type));
|
||||
if (!result.isEmpty() && isConfigLocation(type)) {
|
||||
|
@ -7,7 +7,6 @@
|
||||
#include "qcoreapplication.h"
|
||||
#include <private/qsystemlibrary_p.h>
|
||||
#include "qoperatingsystemversion.h"
|
||||
#include "qpair.h"
|
||||
#include "qset.h"
|
||||
#include "qsocketnotifier.h"
|
||||
#include "qvarlengtharray.h"
|
||||
@ -136,7 +135,7 @@ LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPA
|
||||
QSNDict *sn_vec[4] = { &d->sn_read, &d->sn_write, &d->sn_except, &d->sn_read };
|
||||
QSNDict *dict = sn_vec[type];
|
||||
|
||||
QSockNot *sn = dict ? dict->value(wp) : 0;
|
||||
QSockNot *sn = dict ? dict->value(qintptr(wp)) : 0;
|
||||
if (sn == nullptr) {
|
||||
d->postActivateSocketNotifiers();
|
||||
} else {
|
||||
@ -414,7 +413,7 @@ void QEventDispatcherWin32Private::sendTimerEvent(int timerId)
|
||||
}
|
||||
}
|
||||
|
||||
void QEventDispatcherWin32Private::doWsaAsyncSelect(int socket, long event)
|
||||
void QEventDispatcherWin32Private::doWsaAsyncSelect(qintptr socket, long event)
|
||||
{
|
||||
Q_ASSERT(internalHwnd);
|
||||
// BoundsChecker may emit a warning for WSAAsyncSelect when event == 0
|
||||
@ -563,7 +562,7 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags)
|
||||
void QEventDispatcherWin32::registerSocketNotifier(QSocketNotifier *notifier)
|
||||
{
|
||||
Q_ASSERT(notifier);
|
||||
int sockfd = notifier->socket();
|
||||
qintptr sockfd = notifier->socket();
|
||||
int type = notifier->type();
|
||||
#ifndef QT_NO_DEBUG
|
||||
if (sockfd < 0) {
|
||||
@ -587,7 +586,7 @@ void QEventDispatcherWin32::registerSocketNotifier(QSocketNotifier *notifier)
|
||||
const char *t[] = { "Read", "Write", "Exception" };
|
||||
/* Variable "socket" below is a function pointer. */
|
||||
qWarning("QSocketNotifier: Multiple socket notifiers for "
|
||||
"same socket %d and type %s", sockfd, t[type]);
|
||||
"same socket %" PRIdQINTPTR " and type %s", sockfd, t[type]);
|
||||
}
|
||||
|
||||
QSockNot *sn = new QSockNot;
|
||||
@ -631,7 +630,7 @@ void QEventDispatcherWin32::unregisterSocketNotifier(QSocketNotifier *notifier)
|
||||
{
|
||||
Q_ASSERT(notifier);
|
||||
#ifndef QT_NO_DEBUG
|
||||
int sockfd = notifier->socket();
|
||||
qintptr sockfd = notifier->socket();
|
||||
if (sockfd < 0) {
|
||||
qWarning("QEventDispatcherWin32::unregisterSocketNotifier: invalid socket identifier");
|
||||
return;
|
||||
@ -648,7 +647,7 @@ void QEventDispatcherWin32::doUnregisterSocketNotifier(QSocketNotifier *notifier
|
||||
{
|
||||
Q_D(QEventDispatcherWin32);
|
||||
int type = notifier->type();
|
||||
int sockfd = notifier->socket();
|
||||
qintptr sockfd = notifier->socket();
|
||||
Q_ASSERT(sockfd >= 0);
|
||||
|
||||
QSFDict::iterator it = d->active_fd.find(sockfd);
|
||||
@ -911,3 +910,5 @@ HWND QEventDispatcherWin32::internalHwnd()
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#include "moc_qeventdispatcher_win_p.cpp"
|
||||
|
@ -51,21 +51,21 @@ bool qt_win_hasPackageIdentity()
|
||||
{
|
||||
#if defined(HAS_APPMODEL)
|
||||
|
||||
static const bool hasPackageIdentity = []() {
|
||||
UINT32 length = 0;
|
||||
switch (const auto result = myGetCurrentPackageFullName(&length, nullptr)) {
|
||||
case ERROR_INSUFFICIENT_BUFFER:
|
||||
return true;
|
||||
case APPMODEL_ERROR_NO_PACKAGE:
|
||||
return false;
|
||||
default:
|
||||
qWarning("Failed to resolve package identity (error code %ld)", result);
|
||||
return false;
|
||||
}
|
||||
}();
|
||||
return hasPackageIdentity;
|
||||
static const bool hasPackageIdentity = []() {
|
||||
UINT32 length = 0;
|
||||
switch (const auto result = myGetCurrentPackageFullName(&length, nullptr)) {
|
||||
case ERROR_INSUFFICIENT_BUFFER:
|
||||
return true;
|
||||
case APPMODEL_ERROR_NO_PACKAGE:
|
||||
return false;
|
||||
default:
|
||||
qWarning("Failed to resolve package identity (error code %ld)", result);
|
||||
return false;
|
||||
}
|
||||
}();
|
||||
return hasPackageIdentity;
|
||||
#else
|
||||
return false;
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -15,15 +15,15 @@
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <qdeadlinetimer.h>
|
||||
#include <private/qglobal_p.h>
|
||||
#include <QtCore/qtsan_impl.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace QtDummyFutex {
|
||||
constexpr inline bool futexAvailable() { return false; }
|
||||
template <typename Atomic>
|
||||
inline bool futexWait(Atomic &, typename Atomic::Type, int = 0)
|
||||
inline bool futexWait(Atomic &, typename Atomic::Type, QDeadlineTimer = {})
|
||||
{ Q_UNREACHABLE_RETURN(false); }
|
||||
template <typename Atomic> inline void futexWakeOne(Atomic &)
|
||||
{ Q_UNREACHABLE(); }
|
||||
@ -33,82 +33,16 @@ namespace QtDummyFutex {
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#if defined(Q_OS_LINUX) && !defined(QT_LINUXBASE)
|
||||
#if defined(Q_OS_DARWIN)
|
||||
# include "qfutex_mac_p.h"
|
||||
#elif defined(Q_OS_FREEBSD)
|
||||
# include "qfutex_freebsd_p.h"
|
||||
#elif defined(Q_OS_LINUX) && !defined(QT_LINUXBASE)
|
||||
// use Linux mutexes everywhere except for LSB builds
|
||||
# include <sys/syscall.h>
|
||||
# include <errno.h>
|
||||
# include <limits.h>
|
||||
# include <unistd.h>
|
||||
# include <asm/unistd.h>
|
||||
# include <linux/futex.h>
|
||||
# define QT_ALWAYS_USE_FUTEX
|
||||
|
||||
// if not defined in linux/futex.h
|
||||
# define FUTEX_PRIVATE_FLAG 128 // added in v2.6.22
|
||||
|
||||
// RISC-V does not supply __NR_futex
|
||||
# ifndef __NR_futex
|
||||
# define __NR_futex __NR_futex_time64
|
||||
# endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace QtLinuxFutex {
|
||||
constexpr inline bool futexAvailable() { return true; }
|
||||
inline int _q_futex(int *addr, int op, int val, quintptr val2 = 0,
|
||||
int *addr2 = nullptr, int val3 = 0) noexcept
|
||||
{
|
||||
QtTsan::futexRelease(addr, addr2);
|
||||
|
||||
// we use __NR_futex because some libcs (like Android's bionic) don't
|
||||
// provide SYS_futex etc.
|
||||
int result = syscall(__NR_futex, addr, op | FUTEX_PRIVATE_FLAG, val, val2, addr2, val3);
|
||||
|
||||
QtTsan::futexAcquire(addr, addr2);
|
||||
|
||||
return result;
|
||||
}
|
||||
template <typename T> int *addr(T *ptr)
|
||||
{
|
||||
int *int_addr = reinterpret_cast<int *>(ptr);
|
||||
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
|
||||
if (sizeof(T) > sizeof(int))
|
||||
int_addr++; //We want a pointer to the least significant half
|
||||
#endif
|
||||
return int_addr;
|
||||
}
|
||||
|
||||
template <typename Atomic>
|
||||
inline void futexWait(Atomic &futex, typename Atomic::Type expectedValue)
|
||||
{
|
||||
_q_futex(addr(&futex), FUTEX_WAIT, qintptr(expectedValue));
|
||||
}
|
||||
template <typename Atomic>
|
||||
inline bool futexWait(Atomic &futex, typename Atomic::Type expectedValue, qint64 nstimeout)
|
||||
{
|
||||
struct timespec ts;
|
||||
ts.tv_sec = nstimeout / 1000 / 1000 / 1000;
|
||||
ts.tv_nsec = nstimeout % (1000 * 1000 * 1000);
|
||||
int r = _q_futex(addr(&futex), FUTEX_WAIT, qintptr(expectedValue), quintptr(&ts));
|
||||
return r == 0 || errno != ETIMEDOUT;
|
||||
}
|
||||
template <typename Atomic> inline void futexWakeOne(Atomic &futex)
|
||||
{
|
||||
_q_futex(addr(&futex), FUTEX_WAKE, 1);
|
||||
}
|
||||
template <typename Atomic> inline void futexWakeAll(Atomic &futex)
|
||||
{
|
||||
_q_futex(addr(&futex), FUTEX_WAKE, INT_MAX);
|
||||
}
|
||||
template <typename Atomic> inline
|
||||
void futexWakeOp(Atomic &futex1, int wake1, int wake2, Atomic &futex2, quint32 op)
|
||||
{
|
||||
_q_futex(addr(&futex1), FUTEX_WAKE_OP, wake1, wake2, addr(&futex2), op);
|
||||
}
|
||||
}
|
||||
namespace QtFutex = QtLinuxFutex;
|
||||
QT_END_NAMESPACE
|
||||
# include "qfutex_linux_p.h"
|
||||
//#elif defined(Q_OS_WIN)
|
||||
//# include "qfutex_win_p.h"
|
||||
#else
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace QtFutex = QtDummyFutex;
|
||||
QT_END_NAMESPACE
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include "qmutex.h"
|
||||
#include <qdebug.h>
|
||||
#include "qatomic.h"
|
||||
#include "qelapsedtimer.h"
|
||||
#include "qfutex_p.h"
|
||||
#include "qthread.h"
|
||||
#include "qmutex_p.h"
|
||||
@ -673,12 +672,11 @@ bool QBasicMutex::lockInternal(int timeout) QT_MUTEX_LOCK_NOEXCEPT
|
||||
*/
|
||||
bool QBasicMutex::lockInternal(QDeadlineTimer deadlineTimer) QT_MUTEX_LOCK_NOEXCEPT
|
||||
{
|
||||
qint64 remainingTime = deadlineTimer.remainingTimeNSecs();
|
||||
if (remainingTime == 0)
|
||||
if (deadlineTimer.hasExpired())
|
||||
return false;
|
||||
|
||||
if (futexAvailable()) {
|
||||
if (Q_UNLIKELY(remainingTime < 0)) { // deadlineTimer.isForever()
|
||||
if (Q_UNLIKELY(deadlineTimer.isForever())) {
|
||||
lockInternal();
|
||||
return true;
|
||||
}
|
||||
@ -689,8 +687,8 @@ bool QBasicMutex::lockInternal(QDeadlineTimer deadlineTimer) QT_MUTEX_LOCK_NOEXC
|
||||
if (d_ptr.fetchAndStoreAcquire(dummyFutexValue()) == nullptr)
|
||||
return true;
|
||||
|
||||
Q_FOREVER {
|
||||
if (!futexWait(d_ptr, dummyFutexValue(), remainingTime))
|
||||
for (;;) {
|
||||
if (!futexWait(d_ptr, dummyFutexValue(), deadlineTimer))
|
||||
return false;
|
||||
|
||||
// We got woken up, so must try to acquire the mutex. We must set
|
||||
@ -699,9 +697,7 @@ bool QBasicMutex::lockInternal(QDeadlineTimer deadlineTimer) QT_MUTEX_LOCK_NOEXC
|
||||
if (d_ptr.fetchAndStoreAcquire(dummyFutexValue()) == nullptr)
|
||||
return true;
|
||||
|
||||
// calculate the remaining time
|
||||
remainingTime = deadlineTimer.remainingTimeNSecs();
|
||||
if (remainingTime <= 0)
|
||||
if (deadlineTimer.hasExpired())
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -713,7 +709,7 @@ bool QBasicMutex::lockInternal(QDeadlineTimer deadlineTimer) QT_MUTEX_LOCK_NOEXC
|
||||
continue;
|
||||
|
||||
if (copy == dummyLocked()) {
|
||||
if (remainingTime == 0)
|
||||
if (deadlineTimer.hasExpired())
|
||||
return false;
|
||||
// The mutex is locked but does not have a QMutexPrivate yet.
|
||||
// we need to allocate a QMutexPrivate
|
||||
@ -728,7 +724,7 @@ bool QBasicMutex::lockInternal(QDeadlineTimer deadlineTimer) QT_MUTEX_LOCK_NOEXC
|
||||
}
|
||||
|
||||
QMutexPrivate *d = static_cast<QMutexPrivate *>(copy);
|
||||
if (remainingTime == 0 && !d->possiblyUnlocked.loadRelaxed())
|
||||
if (deadlineTimer.hasExpired() && !d->possiblyUnlocked.loadRelaxed())
|
||||
return false;
|
||||
|
||||
// At this point we have a pointer to a QMutexPrivate. But the other thread
|
||||
@ -790,7 +786,6 @@ bool QBasicMutex::lockInternal(QDeadlineTimer deadlineTimer) QT_MUTEX_LOCK_NOEXC
|
||||
Q_ASSERT(d == d_ptr.loadRelaxed());
|
||||
return true;
|
||||
} else {
|
||||
Q_ASSERT(remainingTime >= 0);
|
||||
// timed out
|
||||
d->derefWaiters(1);
|
||||
//There may be a race in which the mutex is unlocked right after we timed out,
|
||||
@ -915,10 +910,10 @@ QT_END_NAMESPACE
|
||||
|
||||
#if defined(QT_ALWAYS_USE_FUTEX)
|
||||
// nothing
|
||||
#elif defined(Q_OS_MAC)
|
||||
#elif defined(Q_OS_DARWIN)
|
||||
# include "qmutex_mac.cpp"
|
||||
#elif defined(Q_OS_WIN)
|
||||
# include "qmutex_win.cpp"
|
||||
#else
|
||||
# include "qmutex_unix.cpp"
|
||||
#endif
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user