diff options
author | Murray Read <ext-murray.2.read@nokia.com> | 2012-06-18 15:43:19 (GMT) |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-06-21 09:21:28 (GMT) |
commit | 1f9168d3839b2081572368b786c263a04955337c (patch) | |
tree | 6aa26d42e9df43f3a4ec5b0ea0880fd325e58e1e /src/gui | |
parent | 4093ae7ae38f6006f7f8c1438e89777144a0c10b (diff) | |
download | Qt-1f9168d3839b2081572368b786c263a04955337c.zip Qt-1f9168d3839b2081572368b786c263a04955337c.tar.gz Qt-1f9168d3839b2081572368b786c263a04955337c.tar.bz2 |
Removing potential crashes from out-of-thread cleanup on Symbian
There have been some crashes seen on Symbian when its
adoptedThreadMonitor attempts to clean up objects created in other, now
dead, threads. Some of these objects simply can't be cleaned up
properly outside of their original thread, so the thread has to be
checked when they are cleaned up, and cleanup skipped in the wrong
thread.
For pthread created threads, we also have the ability to insert cleanup
code during thread shutdown. This was used in the 4.7 implementation of
QThread on Symbian, and is a better solution for pthread based adopted
threads as it gives in-thread cleanup. So the appropriate pthread code
is also used with changes to adoptedThreadMonitor so that it can run
along side the pthread cleanup code.
Change-Id: Iad8207879b1ece62e5cce85f26a616166aa22486
Reviewed-by: Juha Kukkonen <ext-juha.kukkonen@nokia.com>
Reviewed-by: Pasi Pentikäinen <ext-pasi.a.pentikainen@nokia.com>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qapplication_s60.cpp | 9 | ||||
-rw-r--r-- | src/gui/text/qfontengine_s60.cpp | 6 |
2 files changed, 11 insertions, 4 deletions
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 358d6ad..de5000d 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -2980,8 +2980,13 @@ QS60ThreadLocalData::~QS60ThreadLocalData() releaseFuncs[i](); releaseFuncs.clear(); if (!usingCONEinstances) { - delete screenDevice; - wsSession.Close(); + // wserv has a thread specific handle, do not close it, or delete the screenDevice, if it is not open in this thread + THandleInfo handleInfo; + wsSession.HandleInfo(&handleInfo); + if (handleInfo.iNumOpenInThread) { + delete screenDevice; + wsSession.Close(); + } } } diff --git a/src/gui/text/qfontengine_s60.cpp b/src/gui/text/qfontengine_s60.cpp index 899b5da..2702ca8 100644 --- a/src/gui/text/qfontengine_s60.cpp +++ b/src/gui/text/qfontengine_s60.cpp @@ -298,8 +298,10 @@ QFontEngineS60::QFontEngineS60(const QFontDef &request, const QSymbianTypeFaceEx QFontEngineS60::~QFontEngineS60() { - releaseFont(m_originalFont); - releaseFont(m_scaledFont); + if (QThread::currentThread() == thread()) { + releaseFont(m_originalFont); + releaseFont(m_scaledFont); + } } QFixed QFontEngineS60::emSquareSize() const |