Cleanup of the android clipboard handling

Currently there's an unguarded class member for the clipboard, allocated
but unused and not deleted in the destructor. The getter creates a
static clipboard allocated on the heap. This patch aims to add the
missing guards as well as use the class member.

Task-number: QTBUG-36025


Change-Id: I86969390eebcd67b65707e3ecbd4b3be15c7dadb
Reviewed-by: BogDan Vatra <bogdan@kde.org>
This commit is contained in:
Samuel Gaist 2014-01-22 09:17:39 +01:00 committed by The Qt Project
parent 89bb20b937
commit 73b54f85c5
2 changed files with 13 additions and 5 deletions

View File

@ -118,7 +118,10 @@ QAndroidPlatformIntegration::QAndroidPlatformIntegration(const QStringList &para
m_androidFDB = new QAndroidPlatformFontDatabase();
m_androidPlatformServices = new QAndroidPlatformServices();
#ifndef QT_NO_CLIPBOARD
m_androidPlatformClipboard = new QAndroidPlatformClipboard();
#endif
m_androidSystemLocale = new QAndroidSystemLocale;
}
@ -217,6 +220,11 @@ QAndroidPlatformIntegration::~QAndroidPlatformIntegration()
delete m_androidPlatformNativeInterface;
delete m_androidFDB;
delete m_androidSystemLocale;
#ifndef QT_NO_CLIPBOARD
delete m_androidPlatformClipboard;
#endif
QtAndroid::setAndroidPlatformIntegration(NULL);
}
QPlatformFontDatabase *QAndroidPlatformIntegration::fontDatabase() const
@ -227,11 +235,7 @@ QPlatformFontDatabase *QAndroidPlatformIntegration::fontDatabase() const
#ifndef QT_NO_CLIPBOARD
QPlatformClipboard *QAndroidPlatformIntegration::clipboard() const
{
static QAndroidPlatformClipboard *clipboard = 0;
if (!clipboard)
clipboard = new QAndroidPlatformClipboard;
return clipboard;
return m_androidPlatformClipboard;
}
#endif

View File

@ -171,7 +171,11 @@ private:
QPainter *m_compositePainter;
QAndroidPlatformNativeInterface *m_androidPlatformNativeInterface;
QAndroidPlatformServices *m_androidPlatformServices;
#ifndef QT_NO_CLIPBOARD
QPlatformClipboard *m_androidPlatformClipboard;
#endif
QAndroidSystemLocale *m_androidSystemLocale;
#ifndef QT_NO_ACCESSIBILITY
mutable QPlatformAccessibility *m_accessibility;