IPC: Un-deprecate the "legacy" key API

This the API that has been around since Qt 4.5. We decided not to
deprecate them individually. Instead, we'll deprecate the whole class.

Pick-to: 6.6
Change-Id: Ia930b1a2ed1e465a826ffffd179a1b7b3250fd89
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Thiago Macieira 2023-11-22 17:12:57 -08:00 committed by Volker Hilsheimer
parent b09168740b
commit 905593a40b
4 changed files with 1 additions and 38 deletions

View File

@ -125,23 +125,17 @@ QSharedMemory::QSharedMemory(const QNativeIpcKey &key, QObject *parent)
setNativeKey(key);
}
#if QT_DEPRECATED_SINCE(6, 10)
/*!
\deprecated
Constructs a shared memory object with the given \a parent and with
the legacy key set to \a key. Because its key is set, its create() and
attach() functions can be called.
Legacy keys are deprecated. See \l{Native IPC Keys} for more information.
\sa setKey(), create(), attach()
*/
QSharedMemory::QSharedMemory(const QString &key, QObject *parent)
: QSharedMemory(legacyNativeKey(key), parent)
{
}
#endif
/*!
The destructor clears the key, which forces the shared memory object
@ -160,9 +154,7 @@ QSharedMemory::~QSharedMemory()
d->cleanHandle();
}
#if QT_DEPRECATED_SINCE(6, 10)
/*!
\deprecated
\overload
Sets the legacy \a key for this shared memory object. If \a key is the same
@ -186,7 +178,6 @@ void QSharedMemory::setKey(const QString &key)
{
setNativeKey(legacyNativeKey(key));
}
#endif
/*!
\since 4.8
@ -298,9 +289,7 @@ bool QSharedMemoryPrivate::initKey(SemaphoreAccessMode mode)
return true;
}
#if QT_DEPRECATED_SINCE(6, 10)
/*!
\deprecated
Returns the legacy key assigned with setKey() to this shared memory, or a null key
if no key has been assigned, or if the segment is using a nativeKey(). The
key is the identifier used by Qt applications to identify the shared memory
@ -316,7 +305,6 @@ QString QSharedMemory::key() const
Q_D(const QSharedMemory);
return QNativeIpcKeyPrivate::legacyKey(d->nativeKey);
}
#endif
/*!
\since 4.8

View File

@ -50,14 +50,9 @@ public:
QSharedMemory(const QNativeIpcKey &key, QObject *parent = nullptr);
~QSharedMemory();
#if QT_DEPRECATED_SINCE(6, 10)
QT_DEPRECATED_VERSION_X_6_10("Please refer to 'Native IPC Key' documentation")
QSharedMemory(const QString &key, QObject *parent = nullptr);
QT_DEPRECATED_VERSION_X_6_10("Please refer to 'Native IPC Key' documentation")
void setKey(const QString &key);
QT_DEPRECATED_VERSION_X_6_10("Please refer to 'Native IPC Key' documentation")
QString key() const;
#endif
void setNativeKey(const QNativeIpcKey &key);
void setNativeKey(const QString &key, QNativeIpcKey::Type type = QNativeIpcKey::legacyDefaultTypeForOs())

View File

@ -68,24 +68,13 @@ inline void QSystemSemaphorePrivate::destructBackend()
\sa {Inter-Process Communication}, QSharedMemory, QSemaphore
*/
#if QT_DEPRECATED_SINCE(6, 10)
/*!
\deprecated
Requests a system semaphore identified by the legacy key \a key. This
constructor does the same as:
\code
QSystemSemaphore(QSystemSemaphore::legacyNativeKey(key), initialValue, mode)
\endcode
except that it stores the legacy native key to retrieve using key().
Requests a system semaphore identified by the legacy key \a key.
*/
QSystemSemaphore::QSystemSemaphore(const QString &key, int initialValue, AccessMode mode)
: QSystemSemaphore(legacyNativeKey(key), initialValue, mode)
{
}
#endif
/*!
Requests a system semaphore for the specified \a key. The parameters
@ -226,9 +215,7 @@ QNativeIpcKey QSystemSemaphore::nativeIpcKey() const
return d->nativeKey;
}
#if QT_DEPRECATED_SINCE(6, 10)
/*!
\deprecated
This function works the same as the constructor. It reconstructs
this QSystemSemaphore object. If the new \a key is different from
the old key, calling this function is like calling the destructor of
@ -244,7 +231,6 @@ void QSystemSemaphore::setKey(const QString &key, int initialValue, AccessMode m
}
/*!
\deprecated
Returns the legacy key assigned to this system semaphore. The key is the
name by which the semaphore can be accessed from other processes.
@ -254,7 +240,6 @@ QString QSystemSemaphore::key() const
{
return QNativeIpcKeyPrivate::legacyKey(d->nativeKey);
}
#endif
/*!
Acquires one of the resources guarded by this semaphore, if there is

View File

@ -47,14 +47,9 @@ public:
{ setNativeKey({ key, type }, initialValue, mode); }
QNativeIpcKey nativeIpcKey() const;
#if QT_DEPRECATED_SINCE(6, 10)
QT_DEPRECATED_VERSION_X_6_10("Please refer to 'Native IPC Key' documentation")
QSystemSemaphore(const QString &key, int initialValue = 0, AccessMode mode = Open);
QT_DEPRECATED_VERSION_X_6_10("Please refer to 'Native IPC Key' documentation")
void setKey(const QString &key, int initialValue = 0, AccessMode mode = Open);
QT_DEPRECATED_VERSION_X_6_10("Please refer to 'Native IPC Key' documentation")
QString key() const;
#endif
bool acquire();
bool release(int n = 1);