From 7362b321e5cf2053234bb711340cc1603e1ce812 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 1 Oct 2021 21:29:42 -0700 Subject: Doc: QByteArrayMatcher: add note that the pattern must remain on scope This issue bit me. The API is surprising and very un-Qt-like... Pick-to: 6.2 Change-Id: I2bbf422288924c198645fffd16aa1c58d921bd7e Reviewed-by: Lars Knoll --- src/corelib/text/qbytearraymatcher.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/corelib/text/qbytearraymatcher.cpp b/src/corelib/text/qbytearraymatcher.cpp index ca1791c18b..52c77bb267 100644 --- a/src/corelib/text/qbytearraymatcher.cpp +++ b/src/corelib/text/qbytearraymatcher.cpp @@ -124,10 +124,12 @@ QByteArrayMatcher::QByteArrayMatcher() } /*! - Constructs a byte array matcher from \a pattern. \a pattern - has the given \a length. \a pattern must remain in scope, but - the destructor does not delete \a pattern. - */ + Constructs a byte array matcher from \a pattern. \a pattern + has the given \a length. Call indexIn() to perform a search. + + \note the data that \a pattern is referencing must remain valid while this + object is used. +*/ QByteArrayMatcher::QByteArrayMatcher(const char *pattern, qsizetype length) : d(nullptr) { p.p = reinterpret_cast(pattern); @@ -157,6 +159,9 @@ QByteArrayMatcher::QByteArrayMatcher(const QByteArray &pattern) Constructs a byte array matcher that will search for \a pattern. Call indexIn() to perform a search. + + \note the data that \a pattern is referencing must remain valid while this + object is used. */ /*! -- cgit v1.2.3