summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/io/qlockfile
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2014-10-16 23:40:34 +0200
committerMarc Mutz <marc.mutz@kdab.com>2015-01-04 09:43:25 +0100
commit4560ce4ec6196d356810e24c4c76c92a5934c304 (patch)
tree9c54dcfd886ebb4b4a5a8b151232fca195cea2ef /tests/auto/corelib/io/qlockfile
parentd7fa2d060a58b0e79d7df84a4fc54f44de9b2610 (diff)
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 <david.faure@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/io/qlockfile')
-rw-r--r--tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.cpp8
1 files 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();