diff --git a/src/dbus/qdbusabstractadaptor.cpp b/src/dbus/qdbusabstractadaptor.cpp index 9da2fd3886..5a97fc7b68 100644 --- a/src/dbus/qdbusabstractadaptor.cpp +++ b/src/dbus/qdbusabstractadaptor.cpp @@ -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; }