On Mittwoch, 19. März 2014 00:00:15 CEST, Luigi Toscano wrote:

Yes, but it's more a workaround. It would be interesting to know why that
string (which should contain some value, maybe) is NULL.

Seems this can happen:
http://idevapps.com/forum/showthread.php?tid=625

@Marko
in kdelibs/kdecore/localization/klocale_mac.cpp find
QString KLocaleMacPrivate::macLocaleValue( CFStringRef key ) const
{
   return convert_CFString_to_QString( CFStringRef( CFLocaleGetValue( 
m_macLocale, key ) ) );
}

and change it to

QString KLocaleMacPrivate::macLocaleValue( CFStringRef key ) const
{
   CFStringRef strRef = CFStringRef( CFLocaleGetValue( m_macLocale, key ) );
   qDebug() << "-----";
   CFShow(key);
   CFShow(strRef);
   qDebug() << "====";
   return convert_CFString_to_QString(strRef);
}

and in kdelibs/kdecore/kernel/kkernel_mac.cpp find (on the very top)


QString convert_CFString_to_QString(CFStringRef str) {
+    if (str == NULL) {
+        qDebug() << "This would have crashed.";
+        return QString();
+    }
   CFIndex length = CFStringGetLength(str);
   const UniChar *chars = CFStringGetCharactersPtr(str);
   if (chars)
       return QString(reinterpret_cast<const QChar *>(chars), length);

   QVarLengthArray<UniChar> buffer(length);
   CFStringGetCharacters(str, CFRangeMake(0, length), buffer.data());
   return QString(reinterpret_cast<const QChar *>(buffer.constData()), length);
}

Cheers,
Thomas

Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

Reply via email to