diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2019-09-17 07:35:26 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2019-09-24 18:24:00 -0700 |
commit | 70e6e9fe590590f602dee230a64870365d9301aa (patch) | |
tree | 0a318475b92b14a3c23020fc115be96bbacc1a07 /src/corelib/doc/snippets/code/src_corelib_kernel_qobject.cpp | |
parent | 06cc5d307177ebacf8e6926b9690c12703004a1a (diff) |
Filesystem: avoid crashes on exit in case the locale codec is null
On exit, QLocale::codecForLocale() can return null as the codec may have
already been destroyed. In that case, pretend that Latin1 was the
locale, so any file name is acceptable. This matches QString:
QTextCodec *codec = QTextCodec::codecForLocale();
if (codec)
return codec->toUnicode(str, size);
#endif // textcodec
return fromLatin1(str, size);
Note that if we're wrong and the locale was *not* Latin1, files that you
had a name to may not be encoded or decoded the same way.
Fixes: QTBUG-78446
Change-Id: Iece6e011237e4ab284ecfffd15c54077728a17ca
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/corelib/doc/snippets/code/src_corelib_kernel_qobject.cpp')
0 files changed, 0 insertions, 0 deletions