From d2436f72946950376c6e4aeea1e138f147efd1ad Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 16 Apr 2024 08:09:03 +0200 Subject: [PATCH] QSignalSpy: make verify() methods static ... because they can be. We call them without a value object and while they don't touch *this, ubsan complained (rightfully): qsignalspy.h:29:28: runtime error: member call on address 0x7ffdfaab2b20 which does not point to an object of type 'QSignalSpy' 0x7ffdfaab2b20: note: object has invalid vptr 00 00 00 00 00 00 00 00 00 00 00 00 00 2b 00 00 c0 60 00 00 60 14 00 00 60 60 00 00 70 14 00 00 ^~~~~~~~~~~~~~~~~~~~~~~ invalid vptr Amends e68edd6a07adf33db14c2d2f6e4e3785596fa496. Task-number: QTBUG-123544 Change-Id: I8e9ba3270a35777a704e68130d2f2bccb658a536 Reviewed-by: David Faure Reviewed-by: Ahmad Samir --- src/testlib/qsignalspy.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/testlib/qsignalspy.h b/src/testlib/qsignalspy.h index 6d09ec86953..7809ac3f712 100644 --- a/src/testlib/qsignalspy.h +++ b/src/testlib/qsignalspy.h @@ -29,7 +29,7 @@ public: : QSignalSpy(verify(obj, aSignal)) {} private: - ObjectSignal verify(const QObject *obj, const char *aSignal) + static ObjectSignal verify(const QObject *obj, const char *aSignal) { if (!isObjectValid(obj)) return {}; @@ -69,7 +69,7 @@ public: : QSignalSpy(verify(obj, signal)) {} private: - ObjectSignal verify(const QObject *obj, QMetaMethod signal) + static ObjectSignal verify(const QObject *obj, QMetaMethod signal) { if (isObjectValid(obj) && isSignalMetaMethodValid(signal)) return {obj, signal};