QDBusAdaptorConnector: Initialize cached index in a thread safe way
Move the definition of cachedRelaySlotMethodIndex inside relaySlotMethodIndex() to get thread-safe initialization. Change-Id: I48683078f4dc610e9c7d1591287cf2d1dcfe8778 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>bb10
parent
51d331b13b
commit
57410e5d7d
|
|
@ -22,14 +22,10 @@
|
|||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
static int cachedRelaySlotMethodIndex = 0;
|
||||
|
||||
int QDBusAdaptorConnector::relaySlotMethodIndex()
|
||||
{
|
||||
if (cachedRelaySlotMethodIndex == 0) {
|
||||
cachedRelaySlotMethodIndex = staticMetaObject.indexOfMethod("relaySlot()");
|
||||
Q_ASSERT(cachedRelaySlotMethodIndex != 0); // 0 should be deleteLater() or destroyed()
|
||||
}
|
||||
static const int cachedRelaySlotMethodIndex = staticMetaObject.indexOfMethod("relaySlot()");
|
||||
Q_ASSERT(cachedRelaySlotMethodIndex != 0); // 0 should be deleteLater() or destroyed()
|
||||
return cachedRelaySlotMethodIndex;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue