summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorAlex <qt-info@nokia.com>2009-07-20 15:45:47 +1000
committerAlex <qt-info@nokia.com>2009-07-20 15:53:42 +1000
commitd3a2ba13342880e2912b9a669c8b6f8bc217eb56 (patch)
tree2bdd5e8838599757a6dd8e983d890a0e3a2efa03 /src/corelib
parent1185386dfe9727ed591da442e97084907f0a6735 (diff)
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.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/tools/qregexp.cpp b/src/corelib/tools/qregexp.cpp
index 8dad6e5566..908b4045cc 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)