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>
This commit is contained in:
Eskil Abrahamsen Blomfeldt 2014-10-10 14:31:47 +02:00
parent e4493c41b6
commit 9bbf08fcf3

View File

@ -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