[Interest] Porting to Qt5/macx-xcode Mountain Lion

Joshua Grauman jnfo-c at grauman.com
Fri Jan 25 00:29:07 CET 2013


> On quinta-feira, 24 de janeiro de 2013 14.51.24, Joshua Grauman wrote:
>> Sorry for all the emails, but I finally tracked it down.
>> QTextCodec::codecForName("UTF-8") is returning 0 because I call it before
>> QApplication is initialized. I'm not sure if this is expected behavior or
>> not. In any case, on the other platforms it's not a problem.
>
> It's definitely a bug. Please remember that most Qt API is not supported before
> the QCoreApplication object is initialized, so this bug will have a low
> priority of fixing.

That's fine. It was an easy work-around once I figured out what was 
causing it. But it's nice to be able to track something all the way down 
to ground to be sure what was going on rather than just fiddling with 
things until it works!

Josh

>
>> But where there is definitely a bug in Qt is that
>> QTextCodec::codecForName("UTF-8") caches the results, even when it returns
>> 0. So my early call of QTextCodec::codecForName("UTF-8") gets a 0 cached
>> for UTF-8, which then later causes QTextStream::readLine() to crash when
>> it calls QTextCodec::codecForName("UTF-8"). So looking at the Qt code, an
>> extra condition should be added to make sure null pointers aren't cached
>> in the QTextCodec::codecForName() function. Thanks!
>
> Indeed. The ICU-based codec system has a cache.
>
> However, at first glance, I don't see anything that would cause the lookup to
> fail before QCoreApplication.
>
>



More information about the Interest mailing list