Clean up QCocoaIntegration destruction.
Fix memory leak - delete the font database. Remove the NAApplication delegate. Change-Id: I7c69eb4df01c8450c0abde360f77fbb318b20c83 Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
This commit is contained in:
parent
e58e1abbd9
commit
e97d77d5bc
@ -47,6 +47,7 @@
|
||||
#include "qcocoaautoreleasepool.h"
|
||||
#include "qcocoacursor.h"
|
||||
|
||||
#include <QtCore/QScopedPointer>
|
||||
#include <QtGui/QPlatformIntegration>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@ -90,11 +91,12 @@ public:
|
||||
|
||||
QPlatformTheme *platformTheme() const;
|
||||
private:
|
||||
QPlatformFontDatabase *mFontDb;
|
||||
|
||||
QScopedPointer<QPlatformFontDatabase> mFontDb;
|
||||
QAbstractEventDispatcher *mEventDispatcher;
|
||||
|
||||
QPlatformAccessibility *mAccessibility;
|
||||
QPlatformTheme *mPlatformTheme;
|
||||
QScopedPointer<QPlatformAccessibility> mAccessibility;
|
||||
QScopedPointer<QPlatformTheme> mPlatformTheme;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -89,6 +89,9 @@ QCocoaScreen::~QCocoaScreen()
|
||||
QCocoaIntegration::QCocoaIntegration()
|
||||
: mFontDb(new QCoreTextFontDatabase())
|
||||
, mEventDispatcher(new QCocoaEventDispatcher())
|
||||
, mAccessibility(new QPlatformAccessibility)
|
||||
, mPlatformTheme(new QCocoaTheme)
|
||||
|
||||
{
|
||||
QCocoaAutoReleasePool pool;
|
||||
|
||||
@ -134,13 +137,11 @@ QCocoaIntegration::QCocoaIntegration()
|
||||
screenAdded(screen);
|
||||
}
|
||||
|
||||
mAccessibility = new QPlatformAccessibility;
|
||||
mPlatformTheme = new QCocoaTheme;
|
||||
}
|
||||
|
||||
QCocoaIntegration::~QCocoaIntegration()
|
||||
{
|
||||
delete mAccessibility;
|
||||
[[NSApplication sharedApplication] setDelegate: 0];
|
||||
}
|
||||
|
||||
bool QCocoaIntegration::hasCapability(QPlatformIntegration::Capability cap) const
|
||||
@ -177,7 +178,7 @@ QAbstractEventDispatcher *QCocoaIntegration::guiThreadEventDispatcher() const
|
||||
|
||||
QPlatformFontDatabase *QCocoaIntegration::fontDatabase() const
|
||||
{
|
||||
return mFontDb;
|
||||
return mFontDb.data();
|
||||
}
|
||||
|
||||
QPlatformNativeInterface *QCocoaIntegration::nativeInterface() const
|
||||
@ -187,12 +188,12 @@ QPlatformNativeInterface *QCocoaIntegration::nativeInterface() const
|
||||
|
||||
QPlatformAccessibility *QCocoaIntegration::accessibility() const
|
||||
{
|
||||
return mAccessibility;
|
||||
return mAccessibility.data();
|
||||
}
|
||||
|
||||
QPlatformTheme *QCocoaIntegration::platformTheme() const
|
||||
{
|
||||
return mPlatformTheme;
|
||||
return mPlatformTheme.data();
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
Loading…
x
Reference in New Issue
Block a user