diff options
| author | Marc Mutz <marc.mutz@qt.io> | 2023-05-04 11:17:22 +0200 |
|---|---|---|
| committer | Marc Mutz <marc.mutz@qt.io> | 2023-05-04 19:40:33 +0200 |
| commit | 3fda04644a4d036f4227fe97cb58ababdafcc9f9 (patch) | |
| tree | 60a043d6f32ba68690a46f2d00854d9317a17121 /src/corelib/thread/qrunnable.cpp | |
| parent | f7d1dc0eeeca42c07b42d3a851c52ccf84e946e5 (diff) | |
QRunnable: Extract Method warnNullCallable()
The warning doesn't depend on the template argument, so factor it into
an out-of-line Q_DECL_COLD_FUNCTION. This will automatically mark the
is_null check as [[unlikely]], too.
As a drive-by, use printf-style qWarning() (expands to less code and
doesn't require #include <qdebug.h>).
Change-Id: I9ac2d912eb1d4f3d1d9b41d77700bed6d6850b0a
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/corelib/thread/qrunnable.cpp')
| -rw-r--r-- | src/corelib/thread/qrunnable.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/corelib/thread/qrunnable.cpp b/src/corelib/thread/qrunnable.cpp index 068dc1af2a1..684593e16b8 100644 --- a/src/corelib/thread/qrunnable.cpp +++ b/src/corelib/thread/qrunnable.cpp @@ -10,6 +10,16 @@ QRunnable::~QRunnable() } /*! + \internal + Prints a warning and returns nullptr. +*/ +QRunnable *QRunnable::warnNullCallable() +{ + qWarning("Trying to create null QRunnable. This may stop working."); + return nullptr; +} + +/*! \class QRunnable \inmodule QtCore \since 4.4 |
