diff options
author | Samuel Gaist <samuel.gaist@edeltech.ch> | 2014-01-22 09:17:39 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-23 22:15:13 +0100 |
commit | 73b54f85c543d7e6de4194c1e6c91aa9ce79902d (patch) | |
tree | 720c178d00578ce4e084c6a165892e9f0a2524fd /src/plugins/platforms/android | |
parent | 89bb20b937495fa63741241c8ea9780492fb6e45 (diff) |
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>
Diffstat (limited to 'src/plugins/platforms/android')
-rw-r--r-- | src/plugins/platforms/android/src/qandroidplatformintegration.cpp | 14 | ||||
-rw-r--r-- | src/plugins/platforms/android/src/qandroidplatformintegration.h | 4 |
2 files changed, 13 insertions, 5 deletions
diff --git a/src/plugins/platforms/android/src/qandroidplatformintegration.cpp b/src/plugins/platforms/android/src/qandroidplatformintegration.cpp index e4a2ad582d..9bfb6e9a70 100644 --- a/src/plugins/platforms/android/src/qandroidplatformintegration.cpp +++ b/src/plugins/platforms/android/src/qandroidplatformintegration.cpp @@ -118,7 +118,10 @@ QAndroidPlatformIntegration::QAndroidPlatformIntegration(const QStringList ¶ 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 diff --git a/src/plugins/platforms/android/src/qandroidplatformintegration.h b/src/plugins/platforms/android/src/qandroidplatformintegration.h index 474c1e837e..c5476128a5 100644 --- a/src/plugins/platforms/android/src/qandroidplatformintegration.h +++ b/src/plugins/platforms/android/src/qandroidplatformintegration.h @@ -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; |