From d3a2ba13342880e2912b9a669c8b6f8bc217eb56 Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 20 Jul 2009 15:45:47 +1000 Subject: 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 --- src/corelib/tools/qregexp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib') 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) -- cgit v1.2.3