Don't assume QLocale::codecForLocale always returns non-null
authorThiago Macieira <thiago.macieira@intel.com>
Mon, 14 Apr 2014 22:31:06 +0000 (15:31 -0700)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Sun, 11 May 2014 03:13:49 +0000 (05:13 +0200)
commitf2a40fa07123748ece2fc93790345379f15ef07f
treebb157bbcc3fd5113cf238b80b4e38f185793b80c
parentec8102166449b9b323948c0a8f5fabfa38705139
Don't assume QLocale::codecForLocale always returns non-null

It may return null during program exit, due to QCoreGlobalData global
static already having been destroyed. If that's the case, QTextStream
needs to fall back to Latin 1, like QString::toLocal8Bit and
fromLocal8Bit already do.

Task-number: QTBUG-38316
Change-Id: I5949c8dec15b60f4a13b5d9307ed6abfc799fe20
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
src/corelib/io/qtextstream.cpp
tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp