Mac: Fix crash on Mac OS 10.6 with new scrollbars.

Add missing runtime for OS X version in constructor. This ended up in a
crash when starting a version compiled on 10.7 on 10.6.

Change-Id: I25c5562ee905317554e79d83a2f5236ce9e2a145
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Reviewed-by: Tuukka Turunen <tuukka.turunen@digia.com>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
This commit is contained in:
Christoph Schleifenbaum 2012-07-12 09:18:13 +02:00 committed by Qt by Nokia
parent ea6946318f
commit 770e1d30a2

View File

@ -2107,6 +2107,7 @@ QMacStyle::QMacStyle()
d = new QMacStylePrivate(this);
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) {
d->receiver = [[NotificationReceiver alloc] initWithPrivate:d];
NotificationReceiver *receiver = static_cast<NotificationReceiver *>(d->receiver);
@ -2116,16 +2117,19 @@ QMacStyle::QMacStyle()
object:nil];
d->nsscroller = [[NSScroller alloc] init];
}
#endif
}
QMacStyle::~QMacStyle()
{
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) {
[d->nsscroller release];
NotificationReceiver *receiver = static_cast<NotificationReceiver *>(d->receiver);
[[NSNotificationCenter defaultCenter] removeObserver:receiver];
}
#endif
delete qt_mac_backgroundPattern;