From 4560ce4ec6196d356810e24c4c76c92a5934c304 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 16 Oct 2014 23:40:34 +0200 Subject: [PATCH] tst_QLockFile: simulate a crash better Instead of leaking the QLockFile instance, which causes leak-checkers to emit false positives, simply call exit(), which doesn't run the destructors, yet doesn't lead to leak-checker warnings. Change-Id: Ia61010671e5218ae412e2bcf873e66255a2c5a99 Reviewed-by: David Faure Reviewed-by: Thiago Macieira --- .../qlockfiletesthelper/qlockfile_test_helper.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.cpp b/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.cpp index e4b5d9ab8f..5d1a743dd9 100644 --- a/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.cpp +++ b/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.cpp @@ -50,10 +50,10 @@ int main(int argc, char *argv[]) option = QString::fromLocal8Bit(argv[2]); if (option == "-crash") { - QLockFile *lockFile = new QLockFile(lockName); - lockFile->lock(); - // leak the lockFile on purpose, so that the lock remains! - return 0; + QLockFile lockFile(lockName); + lockFile.lock(); + // exit on purpose, so that the lock remains! + exit(0); } else if (option == "-busy") { QLockFile lockFile(lockName); lockFile.lock();