summaryrefslogtreecommitdiffstats
path: root/src/testlib/qtestcase.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/testlib/qtestcase.cpp')
-rw-r--r--src/testlib/qtestcase.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index 3b5acb6b95..8f8bb83f11 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -901,6 +901,10 @@ void TestMethods::invokeTestOnData(int index) const
if (m_cleanupMethod.isValid())
m_cleanupMethod.invoke(QTest::currentTestObject, Qt::DirectConnection);
+ // Process any deleteLater(), like event-loop based apps would do. Fixes memleak reports.
+ if (QCoreApplication::instance())
+ QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete);
+
// If the test isn't a benchmark, finalize the result after cleanup() has finished.
if (!isBenchmark)
QTestResult::finishedCurrentTestDataCleanup();
@@ -1385,7 +1389,7 @@ void TestMethods::invokeTests(QObject *testObject) const
if (!QTestResult::skipCurrentTest() && !previousFailed) {
for (int i = 0, count = int(m_methods.size()); i < count; ++i) {
- const char *data = Q_NULLPTR;
+ const char *data = nullptr;
if (i < QTest::testTags.size() && !QTest::testTags.at(i).isEmpty())
data = qstrdup(QTest::testTags.at(i).toLatin1().constData());
const bool ok = invokeTest(i, data, watchDog.data());
@@ -1530,7 +1534,7 @@ class DebugSymbolResolver
Q_DISABLE_COPY(DebugSymbolResolver)
public:
struct Symbol {
- Symbol() : name(Q_NULLPTR), address(0) {}
+ Symbol() : name(nullptr), address(0) {}
const char *name; // Must be freed by caller.
DWORD64 address;
@@ -1578,11 +1582,11 @@ void DebugSymbolResolver::cleanup()
if (m_dbgHelpLib)
FreeLibrary(m_dbgHelpLib);
m_dbgHelpLib = 0;
- m_symFromAddr = Q_NULLPTR;
+ m_symFromAddr = nullptr;
}
DebugSymbolResolver::DebugSymbolResolver(HANDLE process)
- : m_process(process), m_dbgHelpLib(0), m_symFromAddr(Q_NULLPTR)
+ : m_process(process), m_dbgHelpLib(0), m_symFromAddr(nullptr)
{
bool success = false;
m_dbgHelpLib = LoadLibraryW(L"dbghelp.dll");