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.
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! Josh > Ok, I think I've found the root problem. QTextCodec::codecByName("UTF-8") > is returning 0. It's a static function, so I'm lost as to why this would > be. I didn't compile my own Qt, just downloaded the main Qt5.0.0-clang SDK > from the qt-project website and installed. This is what is causing the > segfault in QTextStream::readLine(). Any idea what could be causing > codecByName not to find UTF-8? Thanks! > > Josh > >> I'm not sure I did this correctly, but it did give some more information. >> Now I can see that it is segfaulting on QTextCodec::toUnicode(), which >> incidentally, also segfaults in another program I have. So I think I can >> trace most (all?) my segfaults to this function. Thanks for any more help! >> >> Josh >> >> Program received signal EXC_BAD_ACCESS, Could not access memory. >> Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000000 >> 0x000000010195730e in QTextCodec::toUnicode () >> (gdb) backtrace >> #0 0x000000010195730e in QTextCodec::toUnicode () >> #1 0x0000000101a2bea7 in QTextStreamPrivate::fillReadBuffer () >> #2 0x0000000101a2cb1a in QTextStreamPrivate::scan () >> #3 0x0000000101a2e5aa in QTextStream::readLine () >> #4 0x0000000100005e6d in main () >> >>> On quinta-feira, 24 de janeiro de 2013 19.36.02, Andreas Pakulat wrote: >>>>> Thread 0 Crashed:: Dispatch queue: com.apple.main-thread >>>>> 0 QtCore 0x0000000100d6bb0b >>>>> QTextStreamPrivate::fillReadBuffer(long long) + 299 >>>>> 1 QtCore 0x0000000100d6c26f >>>>> QTextStreamPrivate::scan(QChar const**, int*, int, >>>>> QTextStreamPrivate::TokenDelimiter) + 143 >>>>> 2 QtCore 0x0000000100d6d5dd >>>>> QTextStream::readLine(long long) + 125 >>>>> 3 com.yourcompany.trainer 0x0000000100005e59 main + 2825 >>>>> 4 com.yourcompany.trainer 0x00000001000028d4 start + 52 >>>> >>>> Hmm, unfortunately thats not enough, its apparently crashing within >>>> fillReadBuffer, but the line is not available. Presumably this is >>>> because you didn't configure Qt with -debug and hence only minimal >>>> debug information are available. So re-configuring and rebuilding Qt >>>> would most probably give a more helpful information. >>> >>> That's because it's an xcode / Mac OS X backtrace. >>> >>> Please give us a gdb backtrace, of the application when launched with >>> DYLD_IMAGE_SUFFIX=_debug. That should select the debugging version of >>> QtCore. >>> >>> >> _______________________________________________ >> Interest mailing list >> Interest@qt-project.org >> http://lists.qt-project.org/mailman/listinfo/interest >> > _______________________________________________ > Interest mailing list > Interest@qt-project.org > http://lists.qt-project.org/mailman/listinfo/interest > _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest