summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorten Johan Sorvig <morten.sorvig@nokia.com>2012-01-13 13:46:30 +0100
committerQt by Nokia <qt-info@nokia.com>2012-01-14 05:36:12 +0100
commite97d77d5bc72c92f007b51d84f3fab7d16e62d21 (patch)
tree2df30b5d99c4ebc8bc37cb77e8f75551e58cdd45
parente58e1abbd9f4993782e87051f3c96a44a1e208aa (diff)
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>
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.h8
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.mm13
2 files changed, 12 insertions, 9 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.h b/src/plugins/platforms/cocoa/qcocoaintegration.h
index dd0c4aedfe..46e8925ba7 100644
--- a/src/plugins/platforms/cocoa/qcocoaintegration.h
+++ b/src/plugins/platforms/cocoa/qcocoaintegration.h
@@ -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
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm
index 7d91be776a..685b640843 100644
--- a/src/plugins/platforms/cocoa/qcocoaintegration.mm
+++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm
@@ -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