QObject: fix allocation of IDs for the undocumented userData() feature
This appears to have come to some fame on the internet, so better fix the implementation before we remove it in Qt 6. Change-Id: Ia37ca89105b13bea1ffcdce8b2e8cd957b7bd108 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
66223727c7
commit
5696260425
@ -4187,13 +4187,14 @@ void QObject::dumpObjectInfo() const
|
||||
}
|
||||
|
||||
#ifndef QT_NO_USERDATA
|
||||
static QBasicAtomicInteger<uint> user_data_registration = Q_BASIC_ATOMIC_INITIALIZER(0);
|
||||
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
uint QObject::registerUserData()
|
||||
{
|
||||
static int user_data_registration = 0;
|
||||
return user_data_registration++;
|
||||
return user_data_registration.fetchAndAddRelaxed(1);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
Loading…
x
Reference in New Issue
Block a user