QIODevice: do not clear error string on close

Keeping a description of the last device error is a more informative to
the user than forcing the string to 'Unknown error'.

Change-Id: Ie98fe1c94f24279fb633ce950bbe16450b0efdbd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
Alex Trotsenko 2017-11-14 19:26:56 +02:00
parent c1780b9322
commit 2caebf42a7

View File

@ -775,6 +775,7 @@ bool QIODevice::open(OpenMode mode)
d->writeBuffers.clear();
d->setReadChannelCount(isReadable() ? 1 : 0);
d->setWriteChannelCount(isWritable() ? 1 : 0);
d->errorString.clear();
#if defined QIODEVICE_DEBUG
printf("%p QIODevice::open(0x%x)\n", this, quint32(mode));
#endif
@ -801,7 +802,6 @@ void QIODevice::close()
emit aboutToClose();
#endif
d->openMode = NotOpen;
d->errorString.clear();
d->pos = 0;
d->transactionStarted = false;
d->transactionPos = 0;