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 "qcocoaautoreleasepool.h"
|
||||||
#include "qcocoacursor.h"
|
#include "qcocoacursor.h"
|
||||||
|
|
||||||
|
#include <QtCore/QScopedPointer>
|
||||||
#include <QtGui/QPlatformIntegration>
|
#include <QtGui/QPlatformIntegration>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
@ -90,11 +91,12 @@ public:
|
|||||||
|
|
||||||
QPlatformTheme *platformTheme() const;
|
QPlatformTheme *platformTheme() const;
|
||||||
private:
|
private:
|
||||||
QPlatformFontDatabase *mFontDb;
|
|
||||||
|
QScopedPointer<QPlatformFontDatabase> mFontDb;
|
||||||
QAbstractEventDispatcher *mEventDispatcher;
|
QAbstractEventDispatcher *mEventDispatcher;
|
||||||
|
|
||||||
QPlatformAccessibility *mAccessibility;
|
QScopedPointer<QPlatformAccessibility> mAccessibility;
|
||||||
QPlatformTheme *mPlatformTheme;
|
QScopedPointer<QPlatformTheme> mPlatformTheme;
|
||||||
};
|
};
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
@ -89,6 +89,9 @@ QCocoaScreen::~QCocoaScreen()
|
|||||||
QCocoaIntegration::QCocoaIntegration()
|
QCocoaIntegration::QCocoaIntegration()
|
||||||
: mFontDb(new QCoreTextFontDatabase())
|
: mFontDb(new QCoreTextFontDatabase())
|
||||||
, mEventDispatcher(new QCocoaEventDispatcher())
|
, mEventDispatcher(new QCocoaEventDispatcher())
|
||||||
|
, mAccessibility(new QPlatformAccessibility)
|
||||||
|
, mPlatformTheme(new QCocoaTheme)
|
||||||
|
|
||||||
{
|
{
|
||||||
QCocoaAutoReleasePool pool;
|
QCocoaAutoReleasePool pool;
|
||||||
|
|
||||||
@ -134,13 +137,11 @@ QCocoaIntegration::QCocoaIntegration()
|
|||||||
screenAdded(screen);
|
screenAdded(screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
mAccessibility = new QPlatformAccessibility;
|
|
||||||
mPlatformTheme = new QCocoaTheme;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QCocoaIntegration::~QCocoaIntegration()
|
QCocoaIntegration::~QCocoaIntegration()
|
||||||
{
|
{
|
||||||
delete mAccessibility;
|
[[NSApplication sharedApplication] setDelegate: 0];
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QCocoaIntegration::hasCapability(QPlatformIntegration::Capability cap) const
|
bool QCocoaIntegration::hasCapability(QPlatformIntegration::Capability cap) const
|
||||||
@ -177,7 +178,7 @@ QAbstractEventDispatcher *QCocoaIntegration::guiThreadEventDispatcher() const
|
|||||||
|
|
||||||
QPlatformFontDatabase *QCocoaIntegration::fontDatabase() const
|
QPlatformFontDatabase *QCocoaIntegration::fontDatabase() const
|
||||||
{
|
{
|
||||||
return mFontDb;
|
return mFontDb.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
QPlatformNativeInterface *QCocoaIntegration::nativeInterface() const
|
QPlatformNativeInterface *QCocoaIntegration::nativeInterface() const
|
||||||
@ -187,12 +188,12 @@ QPlatformNativeInterface *QCocoaIntegration::nativeInterface() const
|
|||||||
|
|
||||||
QPlatformAccessibility *QCocoaIntegration::accessibility() const
|
QPlatformAccessibility *QCocoaIntegration::accessibility() const
|
||||||
{
|
{
|
||||||
return mAccessibility;
|
return mAccessibility.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
QPlatformTheme *QCocoaIntegration::platformTheme() const
|
QPlatformTheme *QCocoaIntegration::platformTheme() const
|
||||||
{
|
{
|
||||||
return mPlatformTheme;
|
return mPlatformTheme.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user