diff options
author | Alex <qt-info@nokia.com> | 2009-07-20 05:45:47 (GMT) |
---|---|---|
committer | Alex <qt-info@nokia.com> | 2009-07-20 05:53:42 (GMT) |
commit | d3a2ba13342880e2912b9a669c8b6f8bc217eb56 (patch) | |
tree | 2bdd5e8838599757a6dd8e983d890a0e3a2efa03 /src/corelib | |
parent | 1185386dfe9727ed591da442e97084907f0a6735 (diff) | |
download | Qt-d3a2ba13342880e2912b9a669c8b6f8bc217eb56.zip Qt-d3a2ba13342880e2912b9a669c8b6f8bc217eb56.tar.gz Qt-d3a2ba13342880e2912b9a669c8b6f8bc217eb56.tar.bz2 |
fix crash due to null pointer referencing
during application desctruction globalEngineCache is deleted as part
of Q_GLOBAL_STATIC macro. Other instances of code that happen to use
QRegex after the cache destruction will subsequently crash. Most common
reason are other Q_GLOBAL_STATIC instances which happen to use QRegExp
as part of their destructor.
Reviewed-by: Rhys Weatherley
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/tools/qregexp.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/tools/qregexp.cpp b/src/corelib/tools/qregexp.cpp index 8dad6e5..908b404 100644 --- a/src/corelib/tools/qregexp.cpp +++ b/src/corelib/tools/qregexp.cpp @@ -3296,7 +3296,7 @@ static void prepareEngine_helper(QRegExpPrivate *priv) { bool initMatchState = !priv->eng; #if !defined(QT_NO_REGEXP_OPTIM) - if (!priv->eng) { + if (!priv->eng && globalEngineCache()) { QMutexLocker locker(mutex()); priv->eng = globalEngineCache()->take(priv->engineKey); if (priv->eng != 0) |