diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com> | 2014-10-10 14:31:47 +0200 |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com> | 2014-10-10 14:54:27 +0200 |
commit | 9bbf08fcf3ad141b92dda3af2103dac28ff40f00 (patch) | |
tree | f48644e1b10638da26e1df5edf23167b3ed634fa /src/plugins/platforms/android/qandroidplatformclipboard.cpp | |
parent | e4493c41b641273e76558b568196a4629a7c4ea6 (diff) |
Android: Make memory handling in QClipboard consistent with iOS
On iOS we do deleteLater() on the mime data instead of deleting
it directly, in case the application should happen to use the
pointer again directly after setting it on the clipboard.
Technically it would be a bug in the application, but using
deleteLater() is safer and it's better to be consistent with
iOS so that a buggy application crashes in the same places in
both.
Change-Id: I2996d6c7816a2f83615a43609f5be207aaa72c86
Task-number: QTBUG-41853
Reviewed-by: BogDan Vatra <bogdan@kde.org>
Diffstat (limited to 'src/plugins/platforms/android/qandroidplatformclipboard.cpp')
-rw-r--r-- | src/plugins/platforms/android/qandroidplatformclipboard.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/plugins/platforms/android/qandroidplatformclipboard.cpp b/src/plugins/platforms/android/qandroidplatformclipboard.cpp index a975f4a852..fb73db8455 100644 --- a/src/plugins/platforms/android/qandroidplatformclipboard.cpp +++ b/src/plugins/platforms/android/qandroidplatformclipboard.cpp @@ -55,7 +55,8 @@ void QAndroidPlatformClipboard::setMimeData(QMimeData *data, QClipboard::Mode mo { Q_ASSERT(supportsMode(mode)); QtAndroidClipboard::setClipboardText(data != 0 && data->hasText() ? data->text() : QString()); - delete data; + if (data != 0) + data->deleteLater(); } bool QAndroidPlatformClipboard::supportsMode(QClipboard::Mode mode) const |