diff options
authorEskil Abrahamsen Blomfeldt <>2014-10-10 14:31:47 +0200
committerEskil Abrahamsen Blomfeldt <>2014-10-10 14:54:27 +0200
commit9bbf08fcf3ad141b92dda3af2103dac28ff40f00 (patch)
parente4493c41b641273e76558b568196a4629a7c4ea6 (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 <>
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
QtAndroidClipboard::setClipboardText(data != 0 && data->hasText() ? data->text() : QString());
- delete data;
+ if (data != 0)
+ data->deleteLater();
bool QAndroidPlatformClipboard::supportsMode(QClipboard::Mode mode) const