Fix two crashes in OS X 10.6.

Disable rtl control chars (harfbuzz-ng crashes on them).
Disable creating state of not yet created top level windows.
This commit is contained in:
John Preston 2017-12-01 20:55:16 +04:00
parent 8391d43057
commit d6f7cae024
5 changed files with 20 additions and 4 deletions

View File

@ -104,6 +104,7 @@ DBIPlatform gPlatform = dbipLinux32;
QString gPlatformString; QString gPlatformString;
QUrl gUpdateURL; QUrl gUpdateURL;
bool gIsElCapitan = false; bool gIsElCapitan = false;
bool gIsSnowLeopard = false;
int gOtherOnline = 0; int gOtherOnline = 0;
@ -195,6 +196,9 @@ void InitFromCommandLine(int argc, char *argv[]) {
gIsElCapitan = true; gIsElCapitan = true;
} }
#else // OS_MAC_OLD #else // OS_MAC_OLD
if (QSysInfo::macVersion() < QSysInfo::MV_10_7) {
gIsSnowLeopard = true;
}
gPlatform = dbipMacOld; gPlatform = dbipMacOld;
#endif // OS_MAC_OLD #endif // OS_MAC_OLD
#endif // Q_OS_MAC #endif // Q_OS_MAC

View File

@ -248,6 +248,7 @@ DeclareSetting(int32, IntRetinaFactor);
DeclareReadSetting(DBIPlatform, Platform); DeclareReadSetting(DBIPlatform, Platform);
DeclareReadSetting(QString, PlatformString); DeclareReadSetting(QString, PlatformString);
DeclareReadSetting(bool, IsElCapitan); DeclareReadSetting(bool, IsElCapitan);
DeclareReadSetting(bool, IsSnowLeopard);
DeclareReadSetting(QUrl, UpdateURL); DeclareReadSetting(QUrl, UpdateURL);
DeclareSetting(int, OtherOnline); DeclareSetting(int, OtherOnline);

View File

@ -37,6 +37,15 @@ inline int32 countBlockHeight(const ITextBlock *b, const style::TextStyle *st) {
} // namespace } // namespace
bool chIsBad(QChar ch) {
#ifdef OS_MAC_OLD
if (cIsSnowLeopard() && (ch == 8207 || ch == 8206)) {
return true;
}
#endif // OS_MAC_OLD
return (ch == 0) || (ch >= 8232 && ch < 8237) || (ch >= 65024 && ch < 65040 && ch != 65039) || (ch >= 127 && ch < 160 && ch != 156) || (cPlatform() == dbipMac && ch >= 0x0B00 && ch <= 0x0B7F && chIsDiac(ch) && cIsElCapitan()); // tmp hack see https://bugreports.qt.io/browse/QTBUG-48910
}
QString textcmdSkipBlock(ushort w, ushort h) { QString textcmdSkipBlock(ushort w, ushort h) {
static QString cmd(5, TextCommand); static QString cmd(5, TextCommand);
cmd[1] = QChar(TextCommandSkipBlock); cmd[1] = QChar(TextCommandSkipBlock);

View File

@ -275,9 +275,9 @@ inline bool chIsSpace(QChar ch, bool rich = false) {
inline bool chIsDiac(QChar ch) { // diac and variation selectors inline bool chIsDiac(QChar ch) { // diac and variation selectors
return (ch.category() == QChar::Mark_NonSpacing) || (ch == 1652) || (ch >= 64606 && ch <= 64611); return (ch.category() == QChar::Mark_NonSpacing) || (ch == 1652) || (ch >= 64606 && ch <= 64611);
} }
inline bool chIsBad(QChar ch) {
return (ch == 0) || (ch >= 8232 && ch < 8237) || (ch >= 65024 && ch < 65040 && ch != 65039) || (ch >= 127 && ch < 160 && ch != 156) || (cPlatform() == dbipMac && ch >= 0x0B00 && ch <= 0x0B7F && chIsDiac(ch) && cIsElCapitan()); // tmp hack see https://bugreports.qt.io/browse/QTBUG-48910 bool chIsBad(QChar ch);
}
inline bool chIsTrimmed(QChar ch, bool rich = false) { inline bool chIsTrimmed(QChar ch, bool rich = false) {
return (!rich || ch != TextCommand) && (chIsSpace(ch) || chIsBad(ch)); return (!rich || ch != TextCommand) && (chIsSpace(ch) || chIsBad(ch));
} }

View File

@ -133,8 +133,10 @@ void CreateWidgetStateRecursive(not_null<QWidget*> target) {
if (!target->testAttribute(Qt::WA_WState_Created)) { if (!target->testAttribute(Qt::WA_WState_Created)) {
if (!target->isWindow()) { if (!target->isWindow()) {
CreateWidgetStateRecursive(target->parentWidget()); CreateWidgetStateRecursive(target->parentWidget());
WidgetCreator::Create(target);
} else if (!cIsSnowLeopard()) {
WidgetCreator::Create(target);
} }
WidgetCreator::Create(target);
} }
} }