From 8ed37d9bba6e2899724d13bd3ba8911c505b1c8c Mon Sep 17 00:00:00 2001 From: mread Date: Thu, 8 Dec 2011 14:00:46 +0000 Subject: Symbian: improving diagnostics for QWaitCondition If a QWaitCondition was deleted while it was waiting, it would crash in the wait() function while trying to use its internal mutex. This crash is not particularly obvious in its cause. QWaitCondition can detect this delete-while-waiting case, issue appropriate warnings and avoid a crash in its internal state. In the app crash case where this problem was found, there is a further crash after this one due to an externally deleted mutex. The app is clearly at fault. But at least there's now more debug info about what the app is doing wrong. Task-number: ou1cimx1#946509 partial fix Reviewed-by: Shane Kearns --- src/corelib/thread/qwaitcondition_symbian.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/corelib/thread/qwaitcondition_symbian.cpp b/src/corelib/thread/qwaitcondition_symbian.cpp index c6414e85c2..ed1011c696 100644 --- a/src/corelib/thread/qwaitcondition_symbian.cpp +++ b/src/corelib/thread/qwaitcondition_symbian.cpp @@ -112,7 +112,10 @@ public: --wakeups; } - mutex.Signal(); + // if err is KErrGeneral it signals that the RCondVar is closed along with the mutex and that this has been deleted + // we must not access any member variables in this case + if (err != KErrGeneral) + mutex.Signal(); if (err && err != KErrTimedOut) report_error(err, "QWaitCondition::wait()", "cv wait"); -- cgit v1.2.1